oneentry 1.0.149 → 1.0.150
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 +8 -0
- package/changelog.md +431 -0
- package/dist/base/asyncModules.js +13 -0
- package/dist/base/stateModule.d.ts +1 -0
- package/dist/base/stateModule.js +3 -0
- package/dist/base/syncModules.d.ts +30 -1
- package/dist/base/syncModules.js +102 -30
- package/dist/base/utils.d.ts +4 -1
- package/dist/blocks/blocksApi.d.ts +108 -2
- package/dist/blocks/blocksApi.js +148 -1
- package/dist/blocks/blocksInterfaces.d.ts +160 -2
- package/dist/blocks/blocksSchemas.d.ts +4 -0
- package/dist/events/eventsApi.d.ts +42 -1
- package/dist/events/eventsApi.js +67 -0
- package/dist/events/eventsInterfaces.d.ts +79 -1
- package/dist/filters/filtersApi.d.ts +31 -0
- package/dist/filters/filtersApi.js +40 -0
- package/dist/filters/filtersInterfaces.d.ts +56 -0
- package/dist/filters/filtersInterfaces.js +2 -0
- package/dist/filters/filtersSchemas.d.ts +32 -0
- package/dist/filters/filtersSchemas.js +29 -0
- package/dist/general-types/generalTypesSchemas.d.ts +16 -0
- package/dist/general-types/generalTypesSchemas.js +10 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +10 -0
- package/dist/pages/pagesInterfaces.d.ts +2 -2
- package/dist/pages/pagesSchemas.d.ts +3 -3
- package/dist/pages/pagesSchemas.js +1 -1
- package/dist/products/productsApi.d.ts +19 -1
- package/dist/products/productsApi.js +29 -7
- package/dist/products/productsInterfaces.d.ts +30 -1
- package/dist/products/productsSchemas.d.ts +4 -0
- package/dist/products/productsSchemas.js +1 -0
- package/dist/subscriptions/subscriptionsApi.d.ts +69 -0
- package/dist/subscriptions/subscriptionsApi.js +102 -0
- package/dist/subscriptions/subscriptionsInterfaces.d.ts +90 -0
- package/dist/subscriptions/subscriptionsInterfaces.js +2 -0
- package/dist/subscriptions/subscriptionsSchemas.d.ts +20 -0
- package/dist/subscriptions/subscriptionsSchemas.js +23 -0
- package/dist/user-activity/userActivityApi.d.ts +30 -0
- package/dist/user-activity/userActivityApi.js +42 -0
- package/dist/user-activity/userActivityInterfaces.d.ts +42 -0
- package/dist/user-activity/userActivityInterfaces.js +2 -0
- package/dist/users/usersApi.d.ts +79 -1
- package/dist/users/usersApi.js +110 -0
- package/dist/users/usersInterfaces.d.ts +155 -1
- package/dist/users/usersSchemas.d.ts +40 -0
- package/dist/users/usersSchemas.js +34 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ const {
|
|
|
46
46
|
Discounts,
|
|
47
47
|
Events,
|
|
48
48
|
FileUploading,
|
|
49
|
+
Filters,
|
|
49
50
|
Forms,
|
|
50
51
|
FormData,
|
|
51
52
|
GeneralTypes,
|
|
@@ -58,9 +59,11 @@ const {
|
|
|
58
59
|
Products,
|
|
59
60
|
ProductStatuses,
|
|
60
61
|
Sitemap,
|
|
62
|
+
Subscriptions,
|
|
61
63
|
System,
|
|
62
64
|
Templates,
|
|
63
65
|
TemplatePreviews,
|
|
66
|
+
UserActivity,
|
|
64
67
|
Users,
|
|
65
68
|
WS,
|
|
66
69
|
} = defineOneEntry('your-url', config)
|
|
@@ -85,6 +88,8 @@ The second parameter of the constructor takes the 'config'. It contains the foll
|
|
|
85
88
|
|
|
86
89
|
- 'langCode' - Set the "langCode" to set the default language. By specifying this parameter once, you don't have to pass the langCode to the methods ONEENTRY API. If you have not passed the default language, it will be set "en_US".
|
|
87
90
|
|
|
91
|
+
- 'guestId' - Optional guest identifier sent as the "x-guest-id" header on unauthenticated requests. It enables guest cart / wishlist / activity flows. In the browser, if you omit it, the SDK generates a stable id and persists it in localStorage. On the server you must pass a per-visitor "guestId" (or call "setGuestId"): the SDK never auto-generates a server id, to avoid sharing one guest across visitors. The header is omitted once a user is authenticated.
|
|
92
|
+
|
|
88
93
|
- 'traficLimit' - Some methods use more than one request to the CMS so that the data you receive is complete and easy to work with. Pass the value "true" for this parameter to save traffic and decide for yourself what data you need. The default value "false".
|
|
89
94
|
|
|
90
95
|
- 'auth' - An object with authorization settings. By default, the SDK is configured to work with tokens inside the user's session and does not require any additional work from you. At the same time, the SDK does not store the session state between sessions. If you are satisfied with such settings, do not pass the variable 'auth' at all.
|
|
@@ -218,6 +223,7 @@ Now you can use the following links to jump to specific entries documentation:
|
|
|
218
223
|
- [Discounts](https://js-sdk.oneentry.cloud/docs/category/discounts)
|
|
219
224
|
- [Events](https://js-sdk.oneentry.cloud/docs/category/events)
|
|
220
225
|
- [FileUploading](https://js-sdk.oneentry.cloud/docs/category/fileuploading)
|
|
226
|
+
- [Filters](https://js-sdk.oneentry.cloud/docs/category/filters)
|
|
221
227
|
- [Forms](https://js-sdk.oneentry.cloud/docs/category/forms-1)
|
|
222
228
|
- [FormData](https://js-sdk.oneentry.cloud/docs/category/formdata)
|
|
223
229
|
- [GeneralTypes](https://js-sdk.oneentry.cloud/docs/category/generaltypes)
|
|
@@ -230,9 +236,11 @@ Now you can use the following links to jump to specific entries documentation:
|
|
|
230
236
|
- [ProductStatuses](https://js-sdk.oneentry.cloud/docs/category/productstatuses)
|
|
231
237
|
- [Products](https://js-sdk.oneentry.cloud/docs/category/products-1)
|
|
232
238
|
- [Sitemap](https://js-sdk.oneentry.cloud/docs/category/sitemap)
|
|
239
|
+
- [Subscriptions](https://js-sdk.oneentry.cloud/docs/category/subscriptions)
|
|
233
240
|
- [System](https://js-sdk.oneentry.cloud/docs/category/system)
|
|
234
241
|
- [Templates](https://js-sdk.oneentry.cloud/docs/category/templates)
|
|
235
242
|
- [TemplatePreviews](https://js-sdk.oneentry.cloud/docs/category/templatepreviews)
|
|
243
|
+
- [UserActivity](https://js-sdk.oneentry.cloud/docs/category/useractivity)
|
|
236
244
|
- [Users](https://js-sdk.oneentry.cloud/docs/category/users-1)
|
|
237
245
|
- [WS](https://js-sdk.oneentry.cloud/docs/category/web-socket)
|
|
238
246
|
- [Advanced examples](https://js-sdk.oneentry.cloud/docs/category/usage-examples)
|
package/changelog.md
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
# SDK Change Log
|
|
2
|
+
|
|
3
|
+
## v.1.0.150
|
|
4
|
+
|
|
5
|
+
### What's New
|
|
6
|
+
|
|
7
|
+
- Subscriptions — new module for paid subscriptions:
|
|
8
|
+
- `subscribe` — create a new subscription and get a payment session.
|
|
9
|
+
- `cancelSubscription` — cancel a subscription.
|
|
10
|
+
- `getAllSubscriptions` — get all available subscription markers.
|
|
11
|
+
- `getActiveSubscriptions` — get markers of the user's active subscriptions.
|
|
12
|
+
- `recoverSubscriptions` — recover a subscription through the Stripe Billing Portal.
|
|
13
|
+
- `ISubscribe`, `ICancelSubscription`, `ICreatedSubscription` — new interfaces.
|
|
14
|
+
|
|
15
|
+
- UserActivity — new module for tracking user/guest activity:
|
|
16
|
+
- `trackUserActivity` — record a user or guest activity event.
|
|
17
|
+
- `ITrackActivity`, `TUserActivityType` — new interfaces/types.
|
|
18
|
+
|
|
19
|
+
- Filters — new module for content filters:
|
|
20
|
+
- `getFilterByMarker` — get a filter by its marker (items tree).
|
|
21
|
+
- `IContentFilter`, `IContentFilterItem`, `TContentFilterItemType` — new interfaces/types.
|
|
22
|
+
|
|
23
|
+
- Users > `getCart`, `setCart`, `addCartItem`, `removeCartItem` — manage the current user's or guest's cart.
|
|
24
|
+
|
|
25
|
+
- Users > `getWishlist`, `setWishlist`, `addWishlistItem`, `removeWishlistItem` — manage the current user's or guest's wishlist.
|
|
26
|
+
|
|
27
|
+
- Users > `ICartResponse`, `ICartItem`, `ICartSet`, `ICartAddItem`, `IWishlistResponse`, `IWishlistItem`, `IWishlistSet`, `IWishlistAddItem` — new interfaces.
|
|
28
|
+
|
|
29
|
+
- Blocks > `getCartComplement`, `getCartComplementByProductIds` — get "complete your cart" products (by cart context or explicit productIds).
|
|
30
|
+
|
|
31
|
+
- Blocks > `getCartSimilar`, `getCartSimilarByProductIds` — get "similar to cart" products (by cart context or explicit productIds).
|
|
32
|
+
|
|
33
|
+
- Blocks > `getWishlistSimilar`, `getWishlistSimilarByProductIds` — get "similar to wishlist" products (by wishlist context or explicit productIds).
|
|
34
|
+
|
|
35
|
+
- Blocks > `getPersonalRecommendations` — get personal recommendations for the user.
|
|
36
|
+
|
|
37
|
+
- Blocks > `getRecentlyViewed` — get recently viewed products.
|
|
38
|
+
|
|
39
|
+
- Blocks > `getRepeatPurchase` — get products for repeat purchase.
|
|
40
|
+
|
|
41
|
+
- Blocks > `getTrending` — get trending products of the block.
|
|
42
|
+
|
|
43
|
+
- Blocks > `getSlides` — get the block's slides tree as a flat pre-order array (slider_block only).
|
|
44
|
+
|
|
45
|
+
- Blocks > `IBlockProductsLookup`, `IContentSlidesResponse`, `IContentSlideItem` — new interfaces.
|
|
46
|
+
|
|
47
|
+
- Events > `getAllEvents` — get all available events.
|
|
48
|
+
|
|
49
|
+
- Events > `subscribeToForm`, `unsubscribeFromForm` — subscribe to / unsubscribe from form events by marker.
|
|
50
|
+
|
|
51
|
+
- Events > `getFormSubscriptions` — get all form subscriptions.
|
|
52
|
+
|
|
53
|
+
- Events > `IContentApiEvent`, `IListFormSubscription`, `ISubscribeFormEvent` — new interfaces.
|
|
54
|
+
|
|
55
|
+
- Products > `getProductsByVectorSearch` — semantic (vector) search for products.
|
|
56
|
+
|
|
57
|
+
- Products > `IVectorSearchProducts` — new interface.
|
|
58
|
+
|
|
59
|
+
- Guest mode — the SDK now sends an `x-guest-id` header on unauthenticated requests, enabling guest cart/wishlist/activity flows:
|
|
60
|
+
- `config.guestId` — optional explicit guest identifier in `defineOneEntry`.
|
|
61
|
+
- `setGuestId(guestId)` — set/clear the guest identifier at runtime (chainable, like `setAccessToken`; pass `''` to clear).
|
|
62
|
+
- In the browser, when not provided, a stable id is generated (via Web Crypto when available) and persisted in `localStorage` (key `oneentry_guest_id`), mirroring the device-metadata strategy.
|
|
63
|
+
- On the server the SDK does NOT auto-generate a guest id (one shared `defineOneEntry` instance would otherwise leak a single guest cart across visitors) — pass a per-visitor `guestId` explicitly.
|
|
64
|
+
- The header is omitted for authenticated requests (when an access token is set).
|
|
65
|
+
|
|
66
|
+
### What's Changed
|
|
67
|
+
|
|
68
|
+
- Blocks > `BlockType` — added `'trending_block'`, `'recently_viewed_block'`, `'repeat_purchase_block'`, `'slider_block'`, `'personal_recommendations_block'`, `'cart_complement_block'`, `'cart_similar_block'`, `'wishlist_similar_block'` values.
|
|
69
|
+
|
|
70
|
+
- Blocks > `getSimilarProducts` — added optional `productId` query parameter.
|
|
71
|
+
|
|
72
|
+
## v.1.0.149
|
|
73
|
+
|
|
74
|
+
### What's Changed
|
|
75
|
+
|
|
76
|
+
- Captcha fix.
|
|
77
|
+
|
|
78
|
+
## v.1.0.148
|
|
79
|
+
|
|
80
|
+
### What's Changed
|
|
81
|
+
|
|
82
|
+
- Small fixes.
|
|
83
|
+
|
|
84
|
+
## v.1.0.147
|
|
85
|
+
|
|
86
|
+
### What's Changed
|
|
87
|
+
|
|
88
|
+
- Small fixes.
|
|
89
|
+
|
|
90
|
+
## v.1.0.146
|
|
91
|
+
|
|
92
|
+
### What's Changed
|
|
93
|
+
|
|
94
|
+
- Small fixes.
|
|
95
|
+
|
|
96
|
+
## v.1.0.145
|
|
97
|
+
|
|
98
|
+
### What's Changed
|
|
99
|
+
|
|
100
|
+
- Small fixes.
|
|
101
|
+
|
|
102
|
+
## v.1.0.144
|
|
103
|
+
|
|
104
|
+
### What's New
|
|
105
|
+
|
|
106
|
+
- Blocks > `getFrequentlyOrderedProducts` — get frequently ordered products by block marker and product id.
|
|
107
|
+
|
|
108
|
+
- Blocks > `BlockType` — added `'frequently_ordered_block'` value.
|
|
109
|
+
|
|
110
|
+
- Discounts > `getBonusBalance` — get bonus balance of the current user.
|
|
111
|
+
|
|
112
|
+
- Discounts > `getBonusHistory` — get bonus transaction history with filtering by type, date range, discount, module and admin flag.
|
|
113
|
+
|
|
114
|
+
- Discounts > `IBonusTransactionEntity` — new interface for bonus transactions.
|
|
115
|
+
|
|
116
|
+
- Orders > `getRefunds` — get all refund requests for an order.
|
|
117
|
+
|
|
118
|
+
- Orders > `createRefundRequest` — create a refund request for an order.
|
|
119
|
+
|
|
120
|
+
- Orders > `cancelRefundRequest` — cancel a refund request for an order.
|
|
121
|
+
|
|
122
|
+
- Orders > `IRefundRequest` — new interface for refund requests.
|
|
123
|
+
|
|
124
|
+
- Orders > `IBaseOrdersEntity` — added `bonusAmount`, `bonusApplied`, `totalDue` fields.
|
|
125
|
+
|
|
126
|
+
- Orders > `IOrderData` — added `bonusAmount` field.
|
|
127
|
+
|
|
128
|
+
- Orders > `ICreateOrderPreview` — added `bonusAmount` field.
|
|
129
|
+
|
|
130
|
+
- Orders > `IOrderPreviewResponse` — added `bonusApplied`, `totalDue` fields.
|
|
131
|
+
|
|
132
|
+
- Products > `IAggregatedProductGroup` — new interface for aggregated product groups.
|
|
133
|
+
|
|
134
|
+
- Discounts > `IDiscountsEntity` — added `bonusEvent` field.
|
|
135
|
+
|
|
136
|
+
- Forms > `IFormConfig` — added `exceptionIds` field.
|
|
137
|
+
|
|
138
|
+
- Pages > `IPagesEntity` — added `rating` field.
|
|
139
|
+
|
|
140
|
+
- Products > `IProductsEntity` — added `rating` field.
|
|
141
|
+
|
|
142
|
+
- Users > `IUserEntity` — added `rating` field.
|
|
143
|
+
|
|
144
|
+
### What's Changed
|
|
145
|
+
|
|
146
|
+
- Discounts > `IDiscountsEntity.type` — removed `'PERSONAL_BONUS'` value.
|
|
147
|
+
|
|
148
|
+
- Discounts > `getAllDiscounts` — removed `'PERSONAL_BONUS'` from type filter parameter.
|
|
149
|
+
|
|
150
|
+
- Forms > `IFormsEntity` — type narrowed to `'order' | 'sing_in_up' | 'collection' | 'data' | 'rating'`, removed `moduleFormConfigs` field.
|
|
151
|
+
|
|
152
|
+
- Products > `getProductsEmptyPage` — changed from GET to POST, added `body` parameter, return type changed to `IAggregatedProductGroup[]`.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## v.1.0.142
|
|
157
|
+
|
|
158
|
+
### What's Changed
|
|
159
|
+
|
|
160
|
+
- Small fixes.
|
|
161
|
+
|
|
162
|
+
### Bug Fixes
|
|
163
|
+
|
|
164
|
+
- `stateModule` — fixed default value of `isShell`: was `false` when `errors` config was not provided, now correctly defaults to `true` (matches documentation). Previously, omitting the `errors` config caused all API errors to be thrown as exceptions instead of being returned as `IError` objects.
|
|
165
|
+
|
|
166
|
+
- `AuthProviderApi.auth()` — fixed token state being overwritten on failed auth: `state.accessToken` and `state.refreshToken` are now only updated when the response is a valid `IAuthEntity`, not when it is an `IError`.
|
|
167
|
+
|
|
168
|
+
- `AuthProviderApi.refresh()` — same fix: tokens and `saveFunction` are now only invoked on successful response, preventing accidental token destruction on refresh failure.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## v.1.0.140
|
|
173
|
+
|
|
174
|
+
### What's New
|
|
175
|
+
|
|
176
|
+
- Discounts — new module with `getAllDiscounts`, `getDiscountByMarker` and `validateDiscountsCoupon` methods.
|
|
177
|
+
|
|
178
|
+
- Orders > `previewOrder` — preview order calculation with discounts and coupons (without saving).
|
|
179
|
+
|
|
180
|
+
- Orders > `getAllStatusesByStorageMarker` — get all statuses by storage marker.
|
|
181
|
+
|
|
182
|
+
- Orders > `IOrderData` — added `couponCode` and `additionalDiscountsMarkers` fields.
|
|
183
|
+
|
|
184
|
+
- Products > `getProductById` — added optional `isNormalized` parameter.
|
|
185
|
+
|
|
186
|
+
- Products > `IFilterParams` — added `pageUrls` field (array).
|
|
187
|
+
|
|
188
|
+
- Sitemap — new module with `updateSitemap` and `listSitemap` methods.
|
|
189
|
+
|
|
190
|
+
### What's Changed
|
|
191
|
+
|
|
192
|
+
- Orders > `IBaseOrdersEntity` — added `couponCode`, `additionalDiscountsMarkers`, `discountConfig` fields.
|
|
193
|
+
|
|
194
|
+
- Orders > `IOrderByMarkerEntity` — added `statusLocalizeInfos` field.
|
|
195
|
+
|
|
196
|
+
- Orders > `getOrderByMarker` — renamed to `getOrdersStorageByMarker`.
|
|
197
|
+
|
|
198
|
+
### What's Deleted
|
|
199
|
+
|
|
200
|
+
- System > validateCaptcha
|
|
201
|
+
|
|
202
|
+
## v.1.0.139
|
|
203
|
+
|
|
204
|
+
### What's Changed
|
|
205
|
+
|
|
206
|
+
- Small fixes.
|
|
207
|
+
|
|
208
|
+
## v.1.0.138
|
|
209
|
+
|
|
210
|
+
### What's New
|
|
211
|
+
|
|
212
|
+
- Added signPrice field to userQuery field for products
|
|
213
|
+
|
|
214
|
+
### What's Changed
|
|
215
|
+
|
|
216
|
+
- Small fixes.
|
|
217
|
+
|
|
218
|
+
## v.1.0.137
|
|
219
|
+
|
|
220
|
+
### What's New
|
|
221
|
+
|
|
222
|
+
- Add Zod validation in critical modules
|
|
223
|
+
|
|
224
|
+
### What's Changed
|
|
225
|
+
|
|
226
|
+
- rename "oauthSignUp" to "oauth"
|
|
227
|
+
|
|
228
|
+
- Small fixes.
|
|
229
|
+
|
|
230
|
+
## v.1.0.136
|
|
231
|
+
|
|
232
|
+
### What's New
|
|
233
|
+
|
|
234
|
+
- Add "timeIntervals" field to AttributeSets
|
|
235
|
+
|
|
236
|
+
- Add "timeIntervals" field to Forms attributes
|
|
237
|
+
|
|
238
|
+
## v.1.0.135
|
|
239
|
+
|
|
240
|
+
### What's New
|
|
241
|
+
|
|
242
|
+
- FormData > updateFormsDataByid - Update one object of form data by id.
|
|
243
|
+
|
|
244
|
+
- FormData > updateFormsDataStatusByid - Update one object of form data status by id.
|
|
245
|
+
|
|
246
|
+
- FormData > deleteFormsDataByid - Delete one object of form data by id.
|
|
247
|
+
|
|
248
|
+
### What's Changed
|
|
249
|
+
|
|
250
|
+
- Small fixes.
|
|
251
|
+
|
|
252
|
+
### What's Deleted
|
|
253
|
+
|
|
254
|
+
- Payments > webhookByMarker
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## v.1.0.134
|
|
259
|
+
|
|
260
|
+
### What's Changed
|
|
261
|
+
|
|
262
|
+
- Change formsData > getFormsDataByMarker - remove parameter isNested
|
|
263
|
+
|
|
264
|
+
- Change formsData > getFormsDataByMarker - add parameter isExtended
|
|
265
|
+
|
|
266
|
+
- Change formsData > getFormsDataByMarker - add body parameter entityparentIdentifier
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## v.1.0.133
|
|
271
|
+
|
|
272
|
+
### What's New
|
|
273
|
+
|
|
274
|
+
- FileUploading > createFileFromUrl - Utility method. Create a File object from a URL for uploading file or use with formData.
|
|
275
|
+
|
|
276
|
+
### What's Changed
|
|
277
|
+
|
|
278
|
+
- Small fixes.
|
|
279
|
+
|
|
280
|
+
### What's Deleted
|
|
281
|
+
|
|
282
|
+
- FormsData > getFormsData
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## v.1.0.132
|
|
287
|
+
|
|
288
|
+
### What's Changed
|
|
289
|
+
|
|
290
|
+
- Small fixes.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## v.1.0.131
|
|
295
|
+
|
|
296
|
+
### What's Changed
|
|
297
|
+
|
|
298
|
+
- Small fixes.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## v.1.0.130
|
|
303
|
+
|
|
304
|
+
### What's New
|
|
305
|
+
|
|
306
|
+
- Added `config.providerMarker` parameter to `defineOneentry` config
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## v.1.0.129
|
|
311
|
+
|
|
312
|
+
### What's Changed
|
|
313
|
+
|
|
314
|
+
- Small fixes.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## v.1.0.128
|
|
319
|
+
|
|
320
|
+
### What's Changed
|
|
321
|
+
|
|
322
|
+
- Extend jsdoc comments.
|
|
323
|
+
|
|
324
|
+
- Small fixes.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## v.1.0.127
|
|
329
|
+
|
|
330
|
+
### What's Changed
|
|
331
|
+
|
|
332
|
+
- Fixed some types errors. Improved fields descriptions.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## v.1.0.126
|
|
337
|
+
|
|
338
|
+
### What's New
|
|
339
|
+
|
|
340
|
+
- AuthProvider > oauthSignUp - User registration (authorizati09on) via OAUTH.
|
|
341
|
+
|
|
342
|
+
- AuthProvider > logoutAll - Logout of user account on all devices.
|
|
343
|
+
|
|
344
|
+
- AuthProvider > getActiveSessionsByMarker - Getting active user session data.
|
|
345
|
+
|
|
346
|
+
- Payments > webhookByMarker - marker: This is a payment account marker.
|
|
347
|
+
|
|
348
|
+
- Products > getProductsCount - Getting the number of products for the entire catalog.
|
|
349
|
+
|
|
350
|
+
- Products > getProductsCountByPageId - Getting the number of products on a catalog page by page ID.
|
|
351
|
+
|
|
352
|
+
- Products > getProductsCountByPageUrl - Getting the number of products on a catalog page by page URL.
|
|
353
|
+
|
|
354
|
+
- System > getApiStat - Getting the number of requests to API
|
|
355
|
+
|
|
356
|
+
- Users > archiveUser - Archiving one user object (marked for deletion).
|
|
357
|
+
|
|
358
|
+
### What's Deleted
|
|
359
|
+
|
|
360
|
+
- Payments > webhookStripe
|
|
361
|
+
|
|
362
|
+
- Payments > getConnected
|
|
363
|
+
|
|
364
|
+
- Pages > getFormsByPageUrl
|
|
365
|
+
|
|
366
|
+
### What's Changed
|
|
367
|
+
|
|
368
|
+
- AuthProvider > getMarker reanmed to getAuthProviderByMarker
|
|
369
|
+
|
|
370
|
+
- FormData > postFormsData - changed the type of the input parameter body to IBodyPostFormData, changed output type to IPostFormResponse.
|
|
371
|
+
|
|
372
|
+
- FormData > getFormsDataByMarker - input parameters scheme changed, changed output type to IFormsByMarkerDataEntity.
|
|
373
|
+
|
|
374
|
+
- Payments > getAccountById - added payment account connection parameters to the settings field.
|
|
375
|
+
|
|
376
|
+
Example settings for stripe
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{
|
|
380
|
+
"stripeAccountId": "acct_1RsDXzHy1QOsjfBI",
|
|
381
|
+
"stripeOnboardingComplete": true,
|
|
382
|
+
"stripePublishableKey": "pk_test_51OO...Y7MS3",
|
|
383
|
+
"successUrl": "https://example.com/success",
|
|
384
|
+
"cancelUrl": "https://example.com/cancel",
|
|
385
|
+
"sessionTimeout": 15
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Example settings for yookassa
|
|
390
|
+
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"shopId": "1234567",
|
|
394
|
+
"secretKey": "test_pazk0r3JNlMEEwQq6t3Syk-qapXL0ArHvdXYxtaDvcv",
|
|
395
|
+
"successUrl": "https://example.com/success",
|
|
396
|
+
"cancelUrl": "https://example.com/cancel",
|
|
397
|
+
"sessionTimeout": 15
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## v.1.0.124
|
|
404
|
+
|
|
405
|
+
### What's Changed
|
|
406
|
+
|
|
407
|
+
- Admins > getAdminsInfo - old sdk version won't work with new data
|
|
408
|
+
|
|
409
|
+
- FileUploading > getFile - Parameter 'filename' in query change into required
|
|
410
|
+
|
|
411
|
+
- FileUploading > delete - Parameter 'filename' in query change into required
|
|
412
|
+
|
|
413
|
+
- Products > getProductsByIds - Add ids in query / Delete ids in path
|
|
414
|
+
|
|
415
|
+
- AuthProvider > changePassword - Add new required field eventIdentifier
|
|
416
|
+
|
|
417
|
+
- Templates > getTemplateByType - Parameter 'type' in query change into not required
|
|
418
|
+
|
|
419
|
+
What's Deleted
|
|
420
|
+
|
|
421
|
+
- ProductStatuses > getProductStatusesById
|
|
422
|
+
|
|
423
|
+
- Templates > getTemplateById
|
|
424
|
+
|
|
425
|
+
- TemplatePreviews > getTemplatePreviewById
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## v.1.0.0
|
|
430
|
+
|
|
431
|
+
Initial relase
|
|
@@ -308,6 +308,8 @@ class AsyncModules extends syncModules_1.default {
|
|
|
308
308
|
'x-app-token': this.state.token,
|
|
309
309
|
// Include the device fingerprint
|
|
310
310
|
'x-device-metadata': this._getDeviceMetadata(),
|
|
311
|
+
// x-guest-id is intentionally omitted: refresh is an auth-only call
|
|
312
|
+
// (a pure guest has no refresh token), so guest scoping does not apply.
|
|
311
313
|
},
|
|
312
314
|
body: JSON.stringify({ refreshToken: this.state.refreshToken }),
|
|
313
315
|
});
|
|
@@ -344,6 +346,17 @@ class AsyncModules extends syncModules_1.default {
|
|
|
344
346
|
'x-app-token': this.state.token,
|
|
345
347
|
},
|
|
346
348
|
};
|
|
349
|
+
// Guest identifier — enables guest cart/wishlist/activity flows.
|
|
350
|
+
// Only sent for unauthenticated requests: once a user is logged in their
|
|
351
|
+
// own identity scopes the data, and sending the guest id would link the
|
|
352
|
+
// anonymous trail to the account. Omitted entirely when no id is available
|
|
353
|
+
// (e.g. server-side without an explicit guestId — see _getGuestId).
|
|
354
|
+
if (!this.state.accessToken) {
|
|
355
|
+
const guestId = this._getGuestId();
|
|
356
|
+
if (guestId) {
|
|
357
|
+
options.headers['x-guest-id'] = guestId;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
347
360
|
// if method = 'POST' add x-device-metadata
|
|
348
361
|
if (method === 'POST') {
|
|
349
362
|
options.headers = {
|
package/dist/base/stateModule.js
CHANGED
|
@@ -49,6 +49,9 @@ class StateModule {
|
|
|
49
49
|
this.url = url;
|
|
50
50
|
this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
|
|
51
51
|
this.token = config.token;
|
|
52
|
+
// Normalize empty string to undefined: an explicit '' must not masquerade
|
|
53
|
+
// as a set guest id (it would otherwise suppress id resolution).
|
|
54
|
+
this.guestId = config.guestId || undefined;
|
|
52
55
|
this.traficLimit = config.traficLimit || false;
|
|
53
56
|
this.validationEnabled = (_c = (_b = config.validation) === null || _b === void 0 ? void 0 : _b.enabled) !== null && _c !== void 0 ? _c : false;
|
|
54
57
|
this.validationStrictMode = (_e = (_d = config.validation) === null || _d === void 0 ? void 0 : _d.strictMode) !== null && _e !== void 0 ? _e : false;
|
|
@@ -14,6 +14,24 @@ export default abstract class SyncModules {
|
|
|
14
14
|
* @param {StateModule} state - StateModule instance.
|
|
15
15
|
*/
|
|
16
16
|
protected constructor(state: StateModule);
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the guest identifier for the current request, or `undefined`.
|
|
19
|
+
*
|
|
20
|
+
* Resolution order:
|
|
21
|
+
* 1. An explicitly configured `state.guestId` (from config or `setGuestId`) — wins.
|
|
22
|
+
* 2. A persistent browser ID stored in localStorage (key `oneentry_guest_id`),
|
|
23
|
+
* stable across sessions and tabs — mirrors the device-metadata strategy.
|
|
24
|
+
* Once resolved it is cached into `state.guestId` (safe: one browser = one user).
|
|
25
|
+
* 3. Otherwise `undefined` — the `x-guest-id` header is simply omitted.
|
|
26
|
+
*
|
|
27
|
+
* IMPORTANT (server-side): the SDK never invents a guest id on the server.
|
|
28
|
+
* `defineOneEntry` is typically created once and shared across many visitors,
|
|
29
|
+
* so a silently-generated server id would be cached into the shared state and
|
|
30
|
+
* leak one guest cart/wishlist across all anonymous visitors. On the server
|
|
31
|
+
* you must pass a per-visitor `guestId` (config or `setGuestId`) yourself.
|
|
32
|
+
* @returns {string | undefined} The guest identifier, or undefined when none is available.
|
|
33
|
+
*/
|
|
34
|
+
protected _getGuestId(): string | undefined;
|
|
17
35
|
/**
|
|
18
36
|
* Constructs the full URL path by appending the given path to the base URL.
|
|
19
37
|
* @param {string} path - The path to append to the base URL.
|
|
@@ -254,6 +272,17 @@ export default abstract class SyncModules {
|
|
|
254
272
|
* @returns {any} The instance of SyncModules for chaining.
|
|
255
273
|
*/
|
|
256
274
|
setRefreshToken(refreshToken: string): any;
|
|
275
|
+
/**
|
|
276
|
+
* Sets the guest identifier in the state.
|
|
277
|
+
*
|
|
278
|
+
* Once set, it is sent as the `x-guest-id` header on unauthenticated requests,
|
|
279
|
+
* enabling guest cart/wishlist/activity flows. Pass an empty string to clear it
|
|
280
|
+
* (the SDK then falls back to the localStorage-backed id in the browser, or to
|
|
281
|
+
* no guest id at all on the server).
|
|
282
|
+
* @param {string} guestId - The guest identifier to set (empty string clears it).
|
|
283
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
284
|
+
*/
|
|
285
|
+
setGuestId(guestId: string): any;
|
|
257
286
|
/**
|
|
258
287
|
* Get deviceMetadata
|
|
259
288
|
*
|
|
@@ -275,7 +304,7 @@ export default abstract class SyncModules {
|
|
|
275
304
|
* 3. Concatenates the hash and the first 12 characters of instanceId.
|
|
276
305
|
*
|
|
277
306
|
* **instanceId strategy:**
|
|
278
|
-
* - Browser: `
|
|
307
|
+
* - Browser: `_getPersistentBrowserId('oneentry_device_id')` — read from localStorage, stable across sessions.
|
|
279
308
|
* - Node.js / no localStorage: `_nodeDeviceId` — generated at instance creation,
|
|
280
309
|
* lives until the process restarts.
|
|
281
310
|
*
|