@applite/js-sdk 0.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 ADDED
@@ -0,0 +1,137 @@
1
+ # @applite/js-sdk
2
+
3
+ A lightweight JavaScript SDK for interacting with Applite UI customer APIs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @applite/js-sdk
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Each method accepts a **single object** that always includes `appId` and `apiKey`, plus fields required by the specific route.
14
+
15
+ ### Instantiate the client
16
+
17
+ ```ts
18
+ import { AppliteUI } from "@applite/js-sdk";
19
+
20
+ const client = new AppliteUI({
21
+ baseUrl: "https://api.example.com", // optional, defaults to relative paths
22
+ });
23
+ ```
24
+
25
+ ### List customers
26
+
27
+ ```ts
28
+ await client.app.customer.list({
29
+ appId: "app_123", // required for the URL path
30
+ apiKey: "api_key_abc", // required for verification
31
+ plateformType: ["STORE", "TRANSPORT"], // optional filter
32
+ });
33
+ ```
34
+
35
+ ### List a few recent customers
36
+
37
+ ```ts
38
+ await client.app.customer.listFew({
39
+ appId: "app_123",
40
+ apiKey: "api_key_abc",
41
+ plateformType: ["STORE"],
42
+ });
43
+ ```
44
+
45
+ ### Authenticate or register a customer
46
+
47
+ ```ts
48
+ await client.app.customer.auth({
49
+ appId: "app_123",
50
+ apiKey: "api_key_abc",
51
+ fullname: "Ada Lovelace",
52
+ telephone: "+2250700000000",
53
+ email: "ada@example.com", // optional
54
+ plateform: "STORE", // optional
55
+ });
56
+ ```
57
+
58
+ ### Check if a customer exists
59
+
60
+ ```ts
61
+ await client.app.customer.check({
62
+ appId: "app_123",
63
+ apiKey: "api_key_abc",
64
+ telephone: "+2250700000000",
65
+ plateform: "STORE", // optional
66
+ });
67
+ ```
68
+
69
+ ### Get a customer by id
70
+
71
+ ```ts
72
+ await client.app.customer.get({
73
+ appId: "app_123",
74
+ apiKey: "api_key_abc",
75
+ id: "customer_456",
76
+ });
77
+ ```
78
+
79
+ ### Update a customer profile
80
+
81
+ ```ts
82
+ await client.app.customer.update({
83
+ appId: "app_123",
84
+ apiKey: "api_key_abc",
85
+ id: "customer_456",
86
+ fullname: "New Name", // optional
87
+ email: "new-email@example.com", // optional
88
+ photoUrl: "https://cdn.example.com/avatar.png", // optional
89
+ gender: "F", // optional, "M" | "F"
90
+ dob: "1990-01-01", // optional
91
+ country: "CI", // optional
92
+ });
93
+ ```
94
+
95
+ ### Work with other app modules
96
+
97
+ Additional helpers map to the remaining API routes using the same single-object parameter style:
98
+
99
+ ```ts
100
+ // List all apps for the authenticated user
101
+ await client.app.info.list({ apiKey: "api_key_abc" });
102
+
103
+ // Create a product inside the store module
104
+ await client.app.store.product.create({
105
+ appId: "app_123",
106
+ apiKey: "api_key_abc",
107
+ name: "T-shirt",
108
+ sellerId: "seller_1",
109
+ categoryId: "cat_1",
110
+ variants: [{ price: 20, quantity: 5, images: [], valueIds: [] }],
111
+ });
112
+
113
+ // Record statistics or query balances
114
+ await client.app.stats.create({
115
+ appId: "app_123",
116
+ apiKey: "api_key_abc",
117
+ type: "ORDERS",
118
+ year: 2024,
119
+ month: "JANUARY",
120
+ amount: 10,
121
+ });
122
+
123
+ await client.app.finance.balance({ appId: "app_123", apiKey: "api_key_abc" });
124
+
125
+ // Manage welcome screen items
126
+ await client.app.welcomeItem.create({
127
+ appId: "app_123",
128
+ apiKey: "api_key_abc",
129
+ fileUrl: "https://cdn.example.com/banner.png",
130
+ plateformType: "STORE",
131
+ });
132
+ ```
133
+
134
+ ## Scripts
135
+
136
+ - `pnpm build` – build CJS/ESM bundles with type declarations.
137
+ - `pnpm test` – run the build with declaration output to validate types.