oneentry 1.0.93 → 1.0.95
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 +105 -1
- package/dist/events/eventsApi.d.ts +6 -6
- package/dist/events/eventsApi.js +6 -6
- package/dist/users/usersInterfaces.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6138,7 +6138,7 @@ You can subscribe to events via the WebSocket to receive notifications
|
|
|
6138
6138
|
const { WS } = defineOneEntry('your-url');
|
|
6139
6139
|
```
|
|
6140
6140
|
|
|
6141
|
-
|
|
6141
|
+
### WS.connect()
|
|
6142
6142
|
|
|
6143
6143
|
This method creates and return an instance of an object Socket.io with a connection.
|
|
6144
6144
|
This method requires mandatory user authorization.
|
|
@@ -6148,3 +6148,107 @@ const socket = await WS.connect()
|
|
|
6148
6148
|
|
|
6149
6149
|
socket.on('my_event', callback)
|
|
6150
6150
|
```
|
|
6151
|
+
|
|
6152
|
+
When the attributes change (if the user is subscribed to the corresponding event and the Websocket option is active in the event)
|
|
6153
|
+
The "attributes" field always contains event attributes (the "events" field), and depending on the selected type of event for the catalog or form, the fields with the attributes "product" contain product attributes, and "user" contains fields from the user form, respectively. For a product, there is an additional field "title" (product name as a string), and for registration and code submission forms, there are additional fields "code" and "email."
|
|
6154
|
+
|
|
6155
|
+
The attribute value is stored in the format *key - marker*, *value - {type, identifier, value}*.
|
|
6156
|
+
|
|
6157
|
+
Example:
|
|
6158
|
+
|
|
6159
|
+
```json
|
|
6160
|
+
{
|
|
6161
|
+
"message": "Message",
|
|
6162
|
+
"attributes": {
|
|
6163
|
+
"company": {
|
|
6164
|
+
"identifier": "company",
|
|
6165
|
+
"type": "string",
|
|
6166
|
+
"value": "OneEntry"
|
|
6167
|
+
}
|
|
6168
|
+
}
|
|
6169
|
+
}
|
|
6170
|
+
```
|
|
6171
|
+
|
|
6172
|
+
|
|
6173
|
+
|
|
6174
|
+
><details>
|
|
6175
|
+
><summary >Schema</summary>
|
|
6176
|
+
>
|
|
6177
|
+
>**message** string <br>
|
|
6178
|
+
>*Text message* <br>
|
|
6179
|
+
>example: Message <br>
|
|
6180
|
+
>
|
|
6181
|
+
>**attributes:** Record<string, any> <br>
|
|
6182
|
+
>*Сontains event attributes* <br>
|
|
6183
|
+
>example: { { "company": { "identifier": "company", "type": "string", "value": "OneEntry" } }<br>
|
|
6184
|
+
>
|
|
6185
|
+
></details>
|
|
6186
|
+
|
|
6187
|
+
|
|
6188
|
+
Product Example:
|
|
6189
|
+
|
|
6190
|
+
```json
|
|
6191
|
+
{
|
|
6192
|
+
"product": {
|
|
6193
|
+
"id": 10,
|
|
6194
|
+
"info": {
|
|
6195
|
+
"title": "Pink Planet",
|
|
6196
|
+
},
|
|
6197
|
+
"status": {
|
|
6198
|
+
"identifier": "available",
|
|
6199
|
+
"info": {
|
|
6200
|
+
"title": "ADD TO CART"
|
|
6201
|
+
}
|
|
6202
|
+
},
|
|
6203
|
+
"attributes": {
|
|
6204
|
+
"currency": {
|
|
6205
|
+
"identifier": "currency",
|
|
6206
|
+
"type": "string",
|
|
6207
|
+
"value": "USD"
|
|
6208
|
+
}
|
|
6209
|
+
}
|
|
6210
|
+
}
|
|
6211
|
+
}
|
|
6212
|
+
```
|
|
6213
|
+
|
|
6214
|
+
|
|
6215
|
+
User Example:
|
|
6216
|
+
|
|
6217
|
+
```json
|
|
6218
|
+
{
|
|
6219
|
+
"user": {
|
|
6220
|
+
"notificationData": {...},
|
|
6221
|
+
"attributes": {...}
|
|
6222
|
+
},
|
|
6223
|
+
"order": {
|
|
6224
|
+
"id": 1,
|
|
6225
|
+
"attributes": {...}
|
|
6226
|
+
}
|
|
6227
|
+
}
|
|
6228
|
+
```
|
|
6229
|
+
|
|
6230
|
+
|
|
6231
|
+
Order Example:
|
|
6232
|
+
|
|
6233
|
+
```json
|
|
6234
|
+
{
|
|
6235
|
+
"user": {
|
|
6236
|
+
"notificationData": {...},
|
|
6237
|
+
"attributes": {...}
|
|
6238
|
+
},
|
|
6239
|
+
"order": {
|
|
6240
|
+
"id": 1,
|
|
6241
|
+
"attributes": {...}
|
|
6242
|
+
}
|
|
6243
|
+
}
|
|
6244
|
+
```
|
|
6245
|
+
|
|
6246
|
+
|
|
6247
|
+
Form Example:
|
|
6248
|
+
|
|
6249
|
+
```json
|
|
6250
|
+
{
|
|
6251
|
+
"email": "string",
|
|
6252
|
+
"formData": {...}
|
|
6253
|
+
}
|
|
6254
|
+
```
|
|
@@ -13,18 +13,18 @@ export default class EventsApi extends AsyncModules implements IEvents {
|
|
|
13
13
|
* Subscribing to an event on a product.
|
|
14
14
|
*
|
|
15
15
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
16
|
-
* @param marker - Event marker.
|
|
17
|
-
* @param langCode - Language code.
|
|
18
|
-
* @param productId - Product id.
|
|
16
|
+
* @param {string} marker - Event marker.
|
|
17
|
+
* @param {number} langCode - Language code.
|
|
18
|
+
* @param {string} productId - Product id.
|
|
19
19
|
*/
|
|
20
20
|
subscribeByMarker(marker: string, productId: number, langCode?: string): Promise<any | IError>;
|
|
21
21
|
/**
|
|
22
22
|
* Unsubscribing to an event on a product.
|
|
23
23
|
*
|
|
24
24
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
25
|
-
* @param marker - Event marker.
|
|
26
|
-
* @param langCode - Language code.
|
|
27
|
-
* @param productId - Product id.
|
|
25
|
+
* @param {string} marker - Event marker.
|
|
26
|
+
* @param {number} langCode - Language code.
|
|
27
|
+
* @param {string} productId - Product id.
|
|
28
28
|
*/
|
|
29
29
|
unsubscribeByMarker(marker: string, productId: number, langCode?: string): Promise<any | IError>;
|
|
30
30
|
}
|
package/dist/events/eventsApi.js
CHANGED
|
@@ -13,9 +13,9 @@ class EventsApi extends asyncModules_1.default {
|
|
|
13
13
|
* Subscribing to an event on a product.
|
|
14
14
|
*
|
|
15
15
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
16
|
-
* @param marker - Event marker.
|
|
17
|
-
* @param langCode - Language code.
|
|
18
|
-
* @param productId - Product id.
|
|
16
|
+
* @param {string} marker - Event marker.
|
|
17
|
+
* @param {number} langCode - Language code.
|
|
18
|
+
* @param {string} productId - Product id.
|
|
19
19
|
*/
|
|
20
20
|
async subscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
21
21
|
const result = await this._fetchPost(`/subscribe/marker/${marker}`, {
|
|
@@ -28,9 +28,9 @@ class EventsApi extends asyncModules_1.default {
|
|
|
28
28
|
* Unsubscribing to an event on a product.
|
|
29
29
|
*
|
|
30
30
|
* @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
|
|
31
|
-
* @param marker - Event marker.
|
|
32
|
-
* @param langCode - Language code.
|
|
33
|
-
* @param productId - Product id.
|
|
31
|
+
* @param {string} marker - Event marker.
|
|
32
|
+
* @param {number} langCode - Language code.
|
|
33
|
+
* @param {string} productId - Product id.
|
|
34
34
|
*/
|
|
35
35
|
async unsubscribeByMarker(marker, productId, langCode = this.state.lang) {
|
|
36
36
|
const result = await this._fetchDelete(`/unsubscribe/marker/${marker}`, {
|