@baziapi/widget 1.0.0 → 1.0.1
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/README.md +11 -8
- package/dist/widget.cjs +1 -1
- package/dist/widget.mjs +1 -1
- package/package.json +15 -6
package/README.md
CHANGED
|
@@ -13,19 +13,19 @@ Add the following snippet anywhere on your website:
|
|
|
13
13
|
<div id="bazi-widget" data-api-key="bazi_live_your_api_key_here"></div>
|
|
14
14
|
|
|
15
15
|
<!-- CDN Script -->
|
|
16
|
-
<script src="https://cdn.
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/@baziapi/widget/dist/widget.mjs" async></script>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
## ⚙️ Configuration Attributes
|
|
22
22
|
|
|
23
|
-
| Attribute | Type | Default
|
|
24
|
-
| :-------------- | :------------------ |
|
|
25
|
-
| `data-api-key` | string | **Required**
|
|
26
|
-
| `data-base-url` | string | `"https://api.
|
|
27
|
-
| `data-theme` | `'light' \| 'dark'` | `'light'`
|
|
28
|
-
| `data-lang` | `'en' \| 'zh'` | `'en'`
|
|
23
|
+
| Attribute | Type | Default | Description |
|
|
24
|
+
| :-------------- | :------------------ | :--------------------------------- | :-------------------------------------------- |
|
|
25
|
+
| `data-api-key` | string | **Required** | Your publishable BaZi API Key |
|
|
26
|
+
| `data-base-url` | string | `"https://api.baziapi.pro/api/v1"` | API Base URL (for testing or proxy endpoints) |
|
|
27
|
+
| `data-theme` | `'light' \| 'dark'` | `'light'` | Theme preference |
|
|
28
|
+
| `data-lang` | `'en' \| 'zh'` | `'en'` | Default language for chart outputs |
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -54,7 +54,10 @@ export default function BaziWidgetPage() {
|
|
|
54
54
|
<div className="p-8">
|
|
55
55
|
<h1 className="text-2xl font-bold mb-4">Calculate Your BaZi Reading</h1>
|
|
56
56
|
<div id="bazi-widget" data-api-key={process.env.NEXT_PUBLIC_BAZI_API_KEY} />
|
|
57
|
-
<Script
|
|
57
|
+
<Script
|
|
58
|
+
src="https://cdn.jsdelivr.net/npm/@baziapi/widget/dist/v1/widget.js"
|
|
59
|
+
strategy="lazyOnload"
|
|
60
|
+
/>
|
|
58
61
|
</div>
|
|
59
62
|
);
|
|
60
63
|
}
|
package/dist/widget.cjs
CHANGED
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
const container = document.getElementById(WIDGET_CONTAINER_ID);
|
|
194
194
|
if (!container) return;
|
|
195
195
|
const apiKey = container.getAttribute("data-api-key") || "";
|
|
196
|
-
const baseUrl = (container.getAttribute("data-base-url") || "https://api.
|
|
196
|
+
const baseUrl = (container.getAttribute("data-base-url") || "https://api.baziapi.pro").replace(
|
|
197
197
|
/\/$/,
|
|
198
198
|
""
|
|
199
199
|
);
|
package/dist/widget.mjs
CHANGED
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
const container = document.getElementById(WIDGET_CONTAINER_ID);
|
|
192
192
|
if (!container) return;
|
|
193
193
|
const apiKey = container.getAttribute("data-api-key") || "";
|
|
194
|
-
const baseUrl = (container.getAttribute("data-base-url") || "https://api.
|
|
194
|
+
const baseUrl = (container.getAttribute("data-base-url") || "https://api.baziapi.pro").replace(
|
|
195
195
|
/\/$/,
|
|
196
196
|
""
|
|
197
197
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baziapi/widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Embeddable interactive Web Widget for BaZi Four Pillars calculator",
|
|
6
6
|
"author": "Md. Nasir Uddin Shoyas",
|
|
@@ -14,13 +14,22 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"typescript": "^5.6.3",
|
|
19
|
-
"unbuild": "^3.0.0"
|
|
20
|
-
},
|
|
21
17
|
"scripts": {
|
|
22
18
|
"build": "unbuild",
|
|
23
19
|
"dev": "unbuild --stub",
|
|
24
20
|
"lint": "eslint src"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.6.3",
|
|
24
|
+
"unbuild": "^3.0.0"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/Shoyas/bazi-api-sdk#readme",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/Shoyas/bazi-api-sdk.git",
|
|
30
|
+
"directory": "packages/bazi-widget"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/Shoyas/bazi-api-sdk/issues"
|
|
25
34
|
}
|
|
26
|
-
}
|
|
35
|
+
}
|