@seeka-labs/cli-apps 3.5.2 → 3.5.4
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/dist/index.js +47183 -0
- package/dist/index.js.map +7 -0
- package/dist/init-template/.gitlab-ci.yml +67 -0
- package/dist/init-template/.nvmrc +1 -0
- package/dist/init-template/README.md +27 -0
- package/dist/init-template/app/.eslintrc.cjs +13 -0
- package/dist/init-template/app/browser/README.md +1 -0
- package/dist/init-template/app/browser/package.json +37 -0
- package/dist/init-template/app/browser/scripts/esbuild/build-browser-plugin.mjs +130 -0
- package/dist/init-template/app/browser/scripts/esbuild/plugins/importAsGlobals.mjs +39 -0
- package/dist/init-template/app/browser/src/browser.ts +12 -0
- package/dist/init-template/app/browser/src/plugin/index.ts +61 -0
- package/dist/init-template/app/browser/tsconfig.json +34 -0
- package/dist/init-template/app/lib/package.json +46 -0
- package/dist/init-template/app/lib/src/index.ts +4 -0
- package/dist/init-template/app/lib/src/models/index.ts +29 -0
- package/dist/init-template/app/lib/src/validation/index.ts +14 -0
- package/dist/init-template/app/lib/tsconfig.json +22 -0
- package/dist/init-template/app/server-azurefunc/.eslintrc.cjs +4 -0
- package/dist/init-template/app/server-azurefunc/.funcignore +19 -0
- package/dist/init-template/app/server-azurefunc/README.md +105 -0
- package/dist/init-template/app/server-azurefunc/host.json +31 -0
- package/dist/init-template/app/server-azurefunc/local.settings.template.json +34 -0
- package/dist/init-template/app/server-azurefunc/package.json +67 -0
- package/dist/init-template/app/server-azurefunc/scripts/dev-queue-setup.js +55 -0
- package/dist/init-template/app/server-azurefunc/src/app/api/router.ts +14 -0
- package/dist/init-template/app/server-azurefunc/src/app/api/routes/getInstallationSettings.ts +13 -0
- package/dist/init-template/app/server-azurefunc/src/app/api/routes/setInstallationSettings.ts +35 -0
- package/dist/init-template/app/server-azurefunc/src/app/jobs/index.ts +61 -0
- package/dist/init-template/app/server-azurefunc/src/app/logging/index.ts +4 -0
- package/dist/init-template/app/server-azurefunc/src/app/models/index.ts +12 -0
- package/dist/init-template/app/server-azurefunc/src/app/services/activites.ts +8 -0
- package/dist/init-template/app/server-azurefunc/src/functions/healthCheck.ts +19 -0
- package/dist/init-template/app/server-azurefunc/src/functions/seekaAppWebhook.ts +202 -0
- package/dist/init-template/app/server-azurefunc/src/functions/trackActivityQueueHandler.ts +49 -0
- package/dist/init-template/app/server-azurefunc/src/functions/ui.ts +51 -0
- package/dist/init-template/app/server-azurefunc/tsconfig.json +24 -0
- package/dist/init-template/app/ui/README.md +40 -0
- package/dist/init-template/app/ui/index.html +21 -0
- package/dist/init-template/app/ui/package.json +72 -0
- package/dist/init-template/app/ui/public/favicon.ico +0 -0
- package/dist/init-template/app/ui/scripts/copy-output.mjs +30 -0
- package/dist/init-template/app/ui/src/App.tsx +72 -0
- package/dist/init-template/app/ui/src/assets/app-icon.svg +1 -0
- package/dist/init-template/app/ui/src/components/setup/steps/complete/index.tsx +32 -0
- package/dist/init-template/app/ui/src/components/setup/steps/first/index.tsx +27 -0
- package/dist/init-template/app/ui/src/components/setup/steps/index.tsx +22 -0
- package/dist/init-template/app/ui/src/components/setup/steps/second/index.tsx +38 -0
- package/dist/init-template/app/ui/src/index.tsx +45 -0
- package/dist/init-template/app/ui/src/routes/home/index.tsx +21 -0
- package/dist/init-template/app/ui/src/vite-env.d.ts +13 -0
- package/dist/init-template/app/ui/tsconfig.json +35 -0
- package/dist/init-template/app/ui/tsconfig.node.json +10 -0
- package/dist/init-template/app/ui/vite.config.mts +48 -0
- package/dist/init-template/package.json +44 -0
- package/dist/init-template/tsconfig.json +24 -0
- package/package.json +1 -1
- package/README.md +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- deploy
|
|
3
|
+
|
|
4
|
+
variables:
|
|
5
|
+
AZURE_FUNC_RESOURCE_NAME: example-app-name
|
|
6
|
+
CI_DEBUG_TRACE: "true"
|
|
7
|
+
NODE_OPTIONS: --max-old-space-size=8192
|
|
8
|
+
VITE_RELEASE_TAG: "$CI_COMMIT_SHORT_SHA"
|
|
9
|
+
VITE_BASE_URL: "/example-app-name-app/"
|
|
10
|
+
VITE_URLS_SEEKA_API_CORE: "https://api.seeka.services"
|
|
11
|
+
VITE_URLS_SEEKA_APP_CORE_ORIGIN: "https://seeka.app"
|
|
12
|
+
|
|
13
|
+
workflow:
|
|
14
|
+
rules:
|
|
15
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
16
|
+
when: never
|
|
17
|
+
- if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
18
|
+
variables:
|
|
19
|
+
HOSTING_REGION_NAME: auea
|
|
20
|
+
HOSTING_ENV_NAME: prod
|
|
21
|
+
when: always
|
|
22
|
+
- if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
23
|
+
variables:
|
|
24
|
+
HOSTING_REGION_NAME: auea
|
|
25
|
+
HOSTING_ENV_NAME: stag
|
|
26
|
+
when: always
|
|
27
|
+
|
|
28
|
+
azure_func:
|
|
29
|
+
cache:
|
|
30
|
+
policy: pull-push
|
|
31
|
+
key: npmCache_app_example-app-name_$CI_COMMIT_BRANCH
|
|
32
|
+
untracked: false
|
|
33
|
+
paths:
|
|
34
|
+
- node_modules/
|
|
35
|
+
- app/server/node_modules/
|
|
36
|
+
- .yarn/install-state.gz
|
|
37
|
+
stage: deploy
|
|
38
|
+
image: node:22
|
|
39
|
+
artifacts:
|
|
40
|
+
when: on_success
|
|
41
|
+
exclude:
|
|
42
|
+
- .git/**/*
|
|
43
|
+
- .git/
|
|
44
|
+
paths:
|
|
45
|
+
- app/*/build/**
|
|
46
|
+
- app/*/dist/**
|
|
47
|
+
environment:
|
|
48
|
+
name: $HOSTING_REGION_NAME/$HOSTING_ENV_NAME/apps
|
|
49
|
+
before_script:
|
|
50
|
+
- echo "installing azure cli"
|
|
51
|
+
- curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
|
52
|
+
- az --version
|
|
53
|
+
- echo "installing Azure Functions Core Tools"
|
|
54
|
+
- npm install -g azure-functions-core-tools@4 --unsafe-perm true
|
|
55
|
+
- echo "logging in to azure"
|
|
56
|
+
- az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
|
|
57
|
+
- az account set --subscription "$AZURE_SUBSCRIPTION_ID"
|
|
58
|
+
- corepack enable
|
|
59
|
+
script:
|
|
60
|
+
- echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
|
|
61
|
+
- yarn install --immutable
|
|
62
|
+
- yarn clean && yarn build
|
|
63
|
+
- cd app/server
|
|
64
|
+
- func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
|
|
65
|
+
only:
|
|
66
|
+
- main
|
|
67
|
+
- staging
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
22
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @example-org-name/example-app-name
|
|
2
|
+
|
|
3
|
+
## Local dev
|
|
4
|
+
|
|
5
|
+
### First run
|
|
6
|
+
`yarn dev:init`
|
|
7
|
+
|
|
8
|
+
1. `yarn clean`
|
|
9
|
+
2. Run
|
|
10
|
+
- server + browser plugin + ui
|
|
11
|
+
- `clear && yarn start:all`
|
|
12
|
+
- server + browser plugin
|
|
13
|
+
- `clear && yarn start:server`
|
|
14
|
+
|
|
15
|
+
### Updating packages
|
|
16
|
+
|
|
17
|
+
#### Seeka SDK packages
|
|
18
|
+
```
|
|
19
|
+
cd repo root
|
|
20
|
+
yarn up "@seeka-labs/*" --mode=update-lockfile
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### All packages
|
|
24
|
+
```
|
|
25
|
+
cd repo root
|
|
26
|
+
npx npm-check-updates@latest -i --workspaces --target minor && npx npm-check-updates@latest -i --workspaces --target minor --dep peer && npx npm-check-updates@latest -i --workspaces --target latest && npx npm-check-updates@latest -i --workspaces --target latest --dep peer
|
|
27
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-env node */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
4
|
+
parser: '@typescript-eslint/parser',
|
|
5
|
+
plugins: ['@typescript-eslint'],
|
|
6
|
+
root: true,
|
|
7
|
+
rules: {
|
|
8
|
+
"@typescript-eslint/no-unused-vars": "warn",
|
|
9
|
+
"@typescript-eslint/no-empty-function": "warn",
|
|
10
|
+
"@typescript-eslint/no-empty-object-type": "warn",
|
|
11
|
+
"@typescript-eslint/no-explicit-any": "warn"
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# `@example-org-name/example-app-name-browser`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@example-org-name/example-app-name-browser",
|
|
3
|
+
"version": "3.5.4",
|
|
4
|
+
"description": "Seeka app browser plugin example-app-name",
|
|
5
|
+
"author": "Seeka company <support@seeka.co>",
|
|
6
|
+
"private": true,
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"lint": "eslint --fix src/ --ext .ts",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"clean": "rimraf dist build package",
|
|
15
|
+
"build": "node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin",
|
|
16
|
+
"build:dev": "node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin dev",
|
|
17
|
+
"watch": "node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin dev watch"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@example-org-name/example-app-name-lib": "workspace:*",
|
|
21
|
+
"@seeka-labs/converge": "^1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@jgoz/esbuild-plugin-typecheck": "^4",
|
|
25
|
+
"@types/lodash-es": "^4",
|
|
26
|
+
"@types/node": "^22",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^8",
|
|
28
|
+
"@typescript-eslint/parser": "^8",
|
|
29
|
+
"esbuild": "^0",
|
|
30
|
+
"eslint": "^9",
|
|
31
|
+
"eslint-plugin-unused-imports": "^4",
|
|
32
|
+
"rimraf": "^6",
|
|
33
|
+
"typescript": "^5",
|
|
34
|
+
"watch": "^1"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "7bdfa73d8fd888cf89d5469f161dd4109172f39a"
|
|
37
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { typecheckPlugin } from '@jgoz/esbuild-plugin-typecheck';
|
|
2
|
+
import { build, context, version } from 'esbuild';
|
|
3
|
+
import { copyFileSync, existsSync, mkdirSync } from 'fs';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import * as watch from 'watch';
|
|
6
|
+
import { importAsGlobals } from './plugins/importAsGlobals.mjs';
|
|
7
|
+
|
|
8
|
+
console.log('esbuild version:', version);
|
|
9
|
+
|
|
10
|
+
if (process.argv.length < 3) {
|
|
11
|
+
throw new Error('Missing arg');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const pluginName = process.argv[2];
|
|
15
|
+
|
|
16
|
+
const mode = process.argv.length > 4 ? process.argv[4] : 'prod';
|
|
17
|
+
const watchBuild = process.argv.length > 5 ? process.argv[5] == 'watch' : false;
|
|
18
|
+
|
|
19
|
+
console.log('mode:', mode);
|
|
20
|
+
console.log('watchBuild:', process.argv[4]);
|
|
21
|
+
|
|
22
|
+
const opts = {
|
|
23
|
+
entryPoints: ['src/browser.ts'],
|
|
24
|
+
bundle: true,
|
|
25
|
+
metafile: true,
|
|
26
|
+
minify: mode === 'dev' ? false : true,
|
|
27
|
+
format: 'iife',
|
|
28
|
+
platform: 'browser',
|
|
29
|
+
//sourcemap: 'external',
|
|
30
|
+
sourcemap: mode === 'dev' ? true : false,
|
|
31
|
+
external: ['@seeka-labs/converge'],
|
|
32
|
+
outfile: `dist/${pluginName}.min.js`,
|
|
33
|
+
plugins: [
|
|
34
|
+
importAsGlobals({
|
|
35
|
+
"@seeka-labs/converge": "SeekaConvergeCore"
|
|
36
|
+
}),
|
|
37
|
+
typecheckPlugin()
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const postBuild = () => {
|
|
42
|
+
// Copy outfile to ../dist/src/browser
|
|
43
|
+
const serverDirNames = ['server-azurefunc']
|
|
44
|
+
|
|
45
|
+
serverDirNames.forEach(dirName => {
|
|
46
|
+
if (existsSync(resolve(`../${dirName}`))) {
|
|
47
|
+
|
|
48
|
+
if (!existsSync(resolve(`../${dirName}/dist/src/browser`))) {
|
|
49
|
+
mkdirSync(resolve(`../${dirName}/dist/src/browser`), {
|
|
50
|
+
recursive: true,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
copyFileSync(resolve(opts.outfile), resolve(`../${dirName}/dist/src/browser`, `${pluginName}.min.js`))
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (watchBuild) {
|
|
60
|
+
const ctx = await context(opts);
|
|
61
|
+
|
|
62
|
+
async function buildWatch() {
|
|
63
|
+
await ctx.rebuild();
|
|
64
|
+
postBuild();
|
|
65
|
+
console.log('build succeeded');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await buildWatch();
|
|
69
|
+
|
|
70
|
+
// Start watch
|
|
71
|
+
let monitorInstance;
|
|
72
|
+
watch.createMonitor(resolve('./src'), function (monitor) {
|
|
73
|
+
console.log('watching ./src, press any key to exit');
|
|
74
|
+
monitorInstance = monitor;
|
|
75
|
+
|
|
76
|
+
monitor.on("created", async function (f, stat) {
|
|
77
|
+
console.log('rebuilding due to file created', f)
|
|
78
|
+
try {
|
|
79
|
+
await buildWatch();
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
console.error(e);
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
monitor.on("changed", async function (f, curr, prev) {
|
|
86
|
+
console.log('rebuilding due to file changed', f)
|
|
87
|
+
try {
|
|
88
|
+
await buildWatch();
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
console.error(e);
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
monitor.on("removed", async function (f, stat) {
|
|
95
|
+
console.log('rebuilding due to file deleted', f)
|
|
96
|
+
try {
|
|
97
|
+
await buildWatch();
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
console.error(e);
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
// Support stopping
|
|
106
|
+
const stopWatch = () => {
|
|
107
|
+
console.log('Stopping watch...');
|
|
108
|
+
try {
|
|
109
|
+
monitorInstance?.stop();
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
process.exit();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
process.on('SIGINT', stopWatch);
|
|
117
|
+
process.on('SIGTERM', stopWatch);
|
|
118
|
+
|
|
119
|
+
const stdin = process.stdin;
|
|
120
|
+
if (stdin?.isTTY && typeof stdin.setRawMode === 'function') {
|
|
121
|
+
stdin.setRawMode(true);
|
|
122
|
+
stdin.resume();
|
|
123
|
+
stdin.setEncoding('utf8');
|
|
124
|
+
stdin.on('data', stopWatch);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
await build(opts);
|
|
129
|
+
postBuild();
|
|
130
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function importAsGlobals(mapping) {
|
|
2
|
+
// https://github.com/evanw/esbuild/issues/337
|
|
3
|
+
// https://stackoverflow.com/a/3561711/153718
|
|
4
|
+
const escRe = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
5
|
+
const filter = new RegExp(
|
|
6
|
+
Object.keys(mapping)
|
|
7
|
+
.map((mod) => `^${escRe(mod)}$`)
|
|
8
|
+
.join("|"),
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: "global-imports",
|
|
13
|
+
setup(build) {
|
|
14
|
+
build.onResolve({ filter }, (args) => {
|
|
15
|
+
if (!mapping[args.path]) {
|
|
16
|
+
throw new Error("Unknown global: " + args.path);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
path: args.path,
|
|
20
|
+
namespace: "external-global",
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
build.onLoad(
|
|
25
|
+
{
|
|
26
|
+
filter,
|
|
27
|
+
namespace: "external-global",
|
|
28
|
+
},
|
|
29
|
+
async (args) => {
|
|
30
|
+
const global = mapping[args.path];
|
|
31
|
+
return {
|
|
32
|
+
contents: `module.exports = ${global};`,
|
|
33
|
+
loader: "js",
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExampleAppAppBrowserSdkPluginConfig } from "@example-org-name/example-app-name-lib";
|
|
2
|
+
import { ExampleAppAppConvergeSdkPlugin } from "./plugin";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
ExampleAppAppConvergeSdkPlugin: (pluginConfig: ExampleAppAppBrowserSdkPluginConfig) => ExampleAppAppConvergeSdkPlugin;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
(window as Window).ExampleAppAppConvergeSdkPlugin = (pluginConfig: ExampleAppAppBrowserSdkPluginConfig) => {
|
|
11
|
+
return new ExampleAppAppConvergeSdkPlugin(pluginConfig);
|
|
12
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConvergeSdk,
|
|
3
|
+
type IActivityCommonProps,
|
|
4
|
+
type IActivityMetadataProps,
|
|
5
|
+
type IConvergePlugin,
|
|
6
|
+
type PersonIdentifiers,
|
|
7
|
+
TrackingActivityNames
|
|
8
|
+
} from '@seeka-labs/converge';
|
|
9
|
+
|
|
10
|
+
import type {ExampleAppAppBrowserSdkPluginConfig} from '@example-org-name/example-app-name-lib';
|
|
11
|
+
|
|
12
|
+
import {version} from '../../package.json';
|
|
13
|
+
|
|
14
|
+
export class ExampleAppAppConvergeSdkPlugin implements IConvergePlugin<ExampleAppAppBrowserSdkPluginConfig> {
|
|
15
|
+
constructor(pluginConfig: ExampleAppAppBrowserSdkPluginConfig) {
|
|
16
|
+
this.type = "seeka-app-example-app-name";
|
|
17
|
+
this.name = this.type + "-" + pluginConfig.appInstallId;
|
|
18
|
+
this.version = version;
|
|
19
|
+
this.sdk = {} as ConvergeSdk;
|
|
20
|
+
this.config = pluginConfig || {};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
sdk: ConvergeSdk;
|
|
24
|
+
|
|
25
|
+
privacyConfig = {
|
|
26
|
+
// TODO
|
|
27
|
+
requiresIabPurposes: []
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
version: string;
|
|
33
|
+
config: ExampleAppAppBrowserSdkPluginConfig;
|
|
34
|
+
|
|
35
|
+
async beforeInit(): Promise<void> {
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async activity(name: TrackingActivityNames, props?: IActivityCommonProps, metadata?: IActivityMetadataProps): Promise<void> {
|
|
40
|
+
this.sdk.debug.log(`ExampleApp - Listened to activity ${name} that was fired by Seeka with props`, {props, metadata});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async collectIdentifiers(): Promise<PersonIdentifiers | undefined> {
|
|
44
|
+
const data = {
|
|
45
|
+
google: {
|
|
46
|
+
gclid: [] as string[]
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
this.sdk.debug.verbose('ExampleApp - collected identifiers', data);
|
|
51
|
+
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async init(_params: any): Promise<void> {
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
isLoaded(): boolean {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": false,
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noImplicitAny": false,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"strictFunctionTypes": true,
|
|
13
|
+
"noUnusedLocals": false,
|
|
14
|
+
"noUnusedParameters": false,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"importHelpers": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"allowSyntheticDefaultImports": true,
|
|
21
|
+
"experimentalDecorators": true,
|
|
22
|
+
"sourceMap": true,
|
|
23
|
+
"types": [
|
|
24
|
+
"node"
|
|
25
|
+
],
|
|
26
|
+
"lib": [
|
|
27
|
+
"ES6",
|
|
28
|
+
"DOM"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"include": [
|
|
32
|
+
"src/browser.ts",
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@example-org-name/example-app-name-lib",
|
|
3
|
+
"version": "3.5.4",
|
|
4
|
+
"description": "Seeka app library for example-app-name",
|
|
5
|
+
"author": "Seeka <administrator@seeka.co>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"private": true,
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/"
|
|
10
|
+
],
|
|
11
|
+
"types": "./dist/lib/types/index.d.ts",
|
|
12
|
+
"source": "src/index.ts",
|
|
13
|
+
"main": "./dist/lib/example-app-name-lib.module.js",
|
|
14
|
+
"module": "./dist/lib/example-app-name-lib.module.js",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@seeka-labs/sdk-apps-core": "../../../workspace:* || ^3",
|
|
17
|
+
"@seeka-labs/sdk-apps-server": "../../../workspace:* || ^3",
|
|
18
|
+
"@types/lodash-es": "^4",
|
|
19
|
+
"@types/node": "^22",
|
|
20
|
+
"esbuild": "^0",
|
|
21
|
+
"lodash-es": "^4",
|
|
22
|
+
"memory-cache": "^0",
|
|
23
|
+
"openid-client": "^6",
|
|
24
|
+
"rimraf": "^6",
|
|
25
|
+
"typescript": "^5",
|
|
26
|
+
"undici": "^7",
|
|
27
|
+
"winston": "^3",
|
|
28
|
+
"zod": "^4"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"axios": "^1"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@seeka-labs/sdk-apps-core": "^3",
|
|
35
|
+
"@seeka-labs/sdk-apps-server": "^3",
|
|
36
|
+
"lodash-es": "^4",
|
|
37
|
+
"undici": "^7",
|
|
38
|
+
"zod": "^4"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"clean": "rimraf build package dist",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"build": "yarn esbuild src/index.ts --outfile=dist/lib/example-app-name-lib.module.js --bundle --analyze --platform=node --format=esm --packages=external --minify && yarn tsc --emitDeclarationOnly",
|
|
44
|
+
"dev": "yarn esbuild src/index.ts --outfile=dist/lib/example-app-name-lib.module.js --bundle --analyze --platform=node --format=esm --packages=external --sourcemap && yarn tsc --emitDeclarationOnly"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SeekaAppUiClientInitConfig} from '@seeka-labs/sdk-apps-core'
|
|
2
|
+
import {SeekaAppInstallContext} from "@seeka-labs/sdk-apps-core";
|
|
3
|
+
|
|
4
|
+
export interface ExampleAppAppBrowserSdkPluginConfig {
|
|
5
|
+
appId: string
|
|
6
|
+
appInstallId: string
|
|
7
|
+
appUrl: string
|
|
8
|
+
installationSettings: {
|
|
9
|
+
browserPluginAppSetting1?: string | null
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type ExampleAppAppInstallSettings = {
|
|
14
|
+
exampleInstallSetting1?: string | null
|
|
15
|
+
exampleInstallSetting2?: number | null
|
|
16
|
+
browserPluginAppSetting1?: string | null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ExampleAppAppUiClientInitState = {
|
|
20
|
+
exampleInstallSetting1?: string | null
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ExampleAppAppInstallState {
|
|
24
|
+
installationSettings?: ExampleAppAppInstallSettings
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ExampleAppAppInstallContext = SeekaAppInstallContext<ExampleAppAppInstallState>
|
|
28
|
+
|
|
29
|
+
export type ExampleAppAppUiClientInitConfig = SeekaAppUiClientInitConfig<ExampleAppAppUiClientInitState>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type {Logger} from "winston";
|
|
2
|
+
import {ExampleAppAppInstallSettings} from "../models";
|
|
3
|
+
|
|
4
|
+
// TODO: Use Zod
|
|
5
|
+
export const validateInstallationSettings = async (installSettings: ExampleAppAppInstallSettings, logger: Logger): Promise<string | null> => {
|
|
6
|
+
// Returning an error message string here will block the installation request or settings update request by the user installing the app
|
|
7
|
+
|
|
8
|
+
if(!installSettings) return null;
|
|
9
|
+
|
|
10
|
+
if(installSettings.exampleInstallSetting2 && installSettings.exampleInstallSetting2 < 2) return 'Example install setting 2 must be greater than 2';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["ESNext"],
|
|
6
|
+
"declarationDir": "./dist/lib/types",
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"noFallthroughCasesInSwitch": true,
|
|
15
|
+
"removeComments": true,
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"declaration": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["src"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
*.ts
|
|
2
|
+
local.settings.json
|
|
3
|
+
test
|
|
4
|
+
scripts/
|
|
5
|
+
src/
|
|
6
|
+
README.md
|
|
7
|
+
tsconfig.json
|
|
8
|
+
.eslintrc.cjs
|
|
9
|
+
|
|
10
|
+
node_modules/@types/
|
|
11
|
+
node_modules/@typescript-eslint/eslint-plugin/
|
|
12
|
+
node_modules/@typescript-eslint/parser/
|
|
13
|
+
node_modules/azure-functions-core-tools/
|
|
14
|
+
node_modules/eslint/
|
|
15
|
+
node_modules/ngrok/
|
|
16
|
+
node_modules/rimraf/
|
|
17
|
+
node_modules/typescript/
|
|
18
|
+
|
|
19
|
+
.gitignore
|