@dyqr/sdk 0.1.0 → 0.1.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/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { DyqrClient } from './client.js';
3
3
  export type { DeepLinkTarget } from './deep-link.js';
4
4
  export { buildDashboardDeepLink } from './deep-link.js';
5
5
  export { DyqrApiError } from './errors.js';
6
+ export type { SmartRoutingCondition, SmartRoutingConditionType, SmartRoutingDevice, SmartRoutingOs, SmartRoutingRuleInput, } from './routing-types.js';
6
7
  export type { CreateLinkInput, CreateLinkResult, DyqrLink, DyqrLinkListItem, GetLinkResult, LinkRedirectMode, ListLinksParams, ListLinksResult, QrFormat, QrImage, QrStyleInput, UpdateLinkInput, } from './types.js';
@@ -0,0 +1,37 @@
1
+ export type SmartRoutingDevice = 'mobile' | 'desktop';
2
+ export type SmartRoutingOs = 'ios' | 'android' | 'windows' | 'macos' | 'linux';
3
+ export type SmartRoutingConditionType = 'country' | 'continent' | 'regionCode' | 'device' | 'os' | 'language' | 'time' | 'clicks';
4
+ export type SmartRoutingCondition = {
5
+ type: 'country';
6
+ countries: string[];
7
+ } | {
8
+ type: 'continent';
9
+ continents: string[];
10
+ } | {
11
+ type: 'regionCode';
12
+ regionCodes: string[];
13
+ } | {
14
+ type: 'device';
15
+ devices: SmartRoutingDevice[];
16
+ } | {
17
+ type: 'os';
18
+ os: SmartRoutingOs[];
19
+ } | {
20
+ type: 'language';
21
+ languages: string[];
22
+ } | {
23
+ type: 'time';
24
+ timezone: string;
25
+ start: string;
26
+ end: string;
27
+ } | {
28
+ type: 'clicks';
29
+ min?: number;
30
+ max?: number;
31
+ };
32
+ export type SmartRoutingRuleInput = {
33
+ id?: string;
34
+ enabled?: boolean;
35
+ conditions?: SmartRoutingCondition[];
36
+ targetUrl: string;
37
+ };
@@ -0,0 +1,5 @@
1
+ // Smart routing 条件类型。与 libs/shared/src/smart-routing-types.ts 保持字段级一致:
2
+ // sdk 需独立发布 npm 且零依赖,不能 import @dyqr/shared(未发布,引入会复刻 issue #41 的
3
+ // 安装 404)。修改任一侧必须同步另一侧,一致性由 packages/admin/test/sdk-routing-types.spec.ts
4
+ // 的编译期赋值断言保证。
5
+ export {};
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { SmartRoutingRuleInput } from './routing-types.js';
1
2
  export type DyqrLink = {
2
3
  alias: string;
3
4
  title: string;
@@ -47,6 +48,7 @@ export type CreateLinkInput = {
47
48
  campaignId?: string | null;
48
49
  qrStyle?: QrStyleInput;
49
50
  qrStyleSource?: 'own' | 'campaign';
51
+ routingRules?: SmartRoutingRuleInput[];
50
52
  };
51
53
  export type UpdateLinkInput = {
52
54
  title?: string;
@@ -59,6 +61,7 @@ export type UpdateLinkInput = {
59
61
  qrStyle?: QrStyleInput;
60
62
  qrStyleSource?: 'own' | 'campaign';
61
63
  isDisabled?: boolean;
64
+ routingRules?: SmartRoutingRuleInput[];
62
65
  };
63
66
  export type ListLinksParams = {
64
67
  page?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dyqr/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Typed client for the DYQR.me short-link & dynamic QR code API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",