oneentry 1.0.149 → 1.0.151

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.
Files changed (58) hide show
  1. package/README.md +8 -0
  2. package/changelog.md +453 -0
  3. package/dist/base/asyncModules.js +13 -0
  4. package/dist/base/stateModule.d.ts +1 -0
  5. package/dist/base/stateModule.js +3 -0
  6. package/dist/base/syncModules.d.ts +30 -1
  7. package/dist/base/syncModules.js +102 -30
  8. package/dist/base/utils.d.ts +4 -1
  9. package/dist/blocks/blocksApi.d.ts +124 -3
  10. package/dist/blocks/blocksApi.js +169 -4
  11. package/dist/blocks/blocksInterfaces.d.ts +177 -4
  12. package/dist/blocks/blocksSchemas.d.ts +4 -0
  13. package/dist/events/eventsApi.d.ts +42 -1
  14. package/dist/events/eventsApi.js +67 -0
  15. package/dist/events/eventsInterfaces.d.ts +79 -1
  16. package/dist/file-uploading/fileUploadingInterfaces.d.ts +2 -0
  17. package/dist/file-uploading/fileUploadingSchemas.d.ts +2 -0
  18. package/dist/file-uploading/fileUploadingSchemas.js +1 -0
  19. package/dist/filters/filtersApi.d.ts +31 -0
  20. package/dist/filters/filtersApi.js +40 -0
  21. package/dist/filters/filtersInterfaces.d.ts +56 -0
  22. package/dist/filters/filtersInterfaces.js +2 -0
  23. package/dist/filters/filtersSchemas.d.ts +32 -0
  24. package/dist/filters/filtersSchemas.js +29 -0
  25. package/dist/forms-data/formsDataInterfaces.d.ts +2 -2
  26. package/dist/forms-data/formsDataSchemas.d.ts +1 -1
  27. package/dist/forms-data/formsDataSchemas.js +1 -1
  28. package/dist/general-types/generalTypesSchemas.d.ts +16 -0
  29. package/dist/general-types/generalTypesSchemas.js +10 -1
  30. package/dist/index.d.ts +13 -0
  31. package/dist/index.js +10 -0
  32. package/dist/orders/ordersInterfaces.d.ts +51 -3
  33. package/dist/orders/ordersSchemas.d.ts +127 -31
  34. package/dist/orders/ordersSchemas.js +53 -30
  35. package/dist/pages/pagesInterfaces.d.ts +14 -8
  36. package/dist/pages/pagesSchemas.d.ts +24 -9
  37. package/dist/pages/pagesSchemas.js +4 -3
  38. package/dist/products/productsApi.d.ts +19 -1
  39. package/dist/products/productsApi.js +42 -8
  40. package/dist/products/productsInterfaces.d.ts +35 -6
  41. package/dist/products/productsSchemas.d.ts +4 -0
  42. package/dist/products/productsSchemas.js +1 -0
  43. package/dist/subscriptions/subscriptionsApi.d.ts +69 -0
  44. package/dist/subscriptions/subscriptionsApi.js +102 -0
  45. package/dist/subscriptions/subscriptionsInterfaces.d.ts +90 -0
  46. package/dist/subscriptions/subscriptionsInterfaces.js +2 -0
  47. package/dist/subscriptions/subscriptionsSchemas.d.ts +20 -0
  48. package/dist/subscriptions/subscriptionsSchemas.js +23 -0
  49. package/dist/user-activity/userActivityApi.d.ts +30 -0
  50. package/dist/user-activity/userActivityApi.js +42 -0
  51. package/dist/user-activity/userActivityInterfaces.d.ts +42 -0
  52. package/dist/user-activity/userActivityInterfaces.js +2 -0
  53. package/dist/users/usersApi.d.ts +79 -1
  54. package/dist/users/usersApi.js +110 -0
  55. package/dist/users/usersInterfaces.d.ts +155 -1
  56. package/dist/users/usersSchemas.d.ts +40 -0
  57. package/dist/users/usersSchemas.js +34 -1
  58. 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,453 @@
1
+ # SDK Change Log
2
+
3
+ ## v.1.0.151
4
+
5
+ ### What's New
6
+
7
+ - Pages > `PageType` — new page-specific type union (`'catalog_page' | 'common_page' | 'error_page' | 'external_page'`), a page subset of `BlockType`.
8
+
9
+ - Orders > `IOrderSplit`, `IOrderSplitStage` — new interfaces describing the split (staged) payment configuration returned by the by-id order endpoint.
10
+
11
+ ### What's Changed
12
+
13
+ - Pages > `IPagesEntity.type` — now typed as the page-specific `PageType` instead of the broad `BlockType` (the value set is unchanged, just narrowed semantically). The page Zod schema validates `type` against the same set.
14
+
15
+ - Pages > `IPagesEntity.categoryPath` — now `string | null` (was `string`); the API returns `null` for nested pages. Page Zod schema relaxed to `z.string().nullable().optional()`.
16
+
17
+ - FormsData > `IPostFormResponseData.fingerprint` — now `string | null` (was `string`); anonymous / app-token submissions return `null`. `PostFormResponseSchema` relaxed to `z.string().nullable()` (previously rejected the real response under strict validation).
18
+
19
+ - Orders > `IOrderDiscountConfig.bonus` — now optional (`bonus?`); the API omits the key entirely on orders without a bonus context (previously failed validation when embedded in create/update order responses).
20
+
21
+ - Orders > `IOrderByMarkerEntity` — now exposes `discountConfig` (`IOrderDiscountConfig | null`), `totalSumRaw`, `isPartial` (`boolean | null`), `paymentStrategy`, and `split`; these fields are returned by the API and were previously stripped from the validated result. `OrderEntitySchema` extended accordingly, and `IOrderDiscountSettings` / `OrderDiscountConfigSchema.settings` gained `giftRefundPolicy`, `maxBonusPaymentPercent`, `minBonusAmount`, `minOrderAmountForBonus`.
22
+
23
+ - FileUploading > `IUploadingReturn.contentType` — added (the upload endpoint always returns the file MIME type); `UploadingReturnSchema` extended with `contentType: z.string()`.
24
+
25
+ ## v.1.0.150
26
+
27
+ ### What's New
28
+
29
+ - Subscriptions — new module for paid subscriptions:
30
+ - `subscribe` — create a new subscription and get a payment session.
31
+ - `cancelSubscription` — cancel a subscription.
32
+ - `getAllSubscriptions` — get all available subscription markers.
33
+ - `getActiveSubscriptions` — get markers of the user's active subscriptions.
34
+ - `recoverSubscriptions` — recover a subscription through the Stripe Billing Portal.
35
+ - `ISubscribe`, `ICancelSubscription`, `ICreatedSubscription` — new interfaces.
36
+
37
+ - UserActivity — new module for tracking user/guest activity:
38
+ - `trackUserActivity` — record a user or guest activity event.
39
+ - `ITrackActivity`, `TUserActivityType` — new interfaces/types.
40
+
41
+ - Filters — new module for content filters:
42
+ - `getFilterByMarker` — get a filter by its marker (items tree).
43
+ - `IContentFilter`, `IContentFilterItem`, `TContentFilterItemType` — new interfaces/types.
44
+
45
+ - Users > `getCart`, `setCart`, `addCartItem`, `removeCartItem` — manage the current user's or guest's cart.
46
+
47
+ - Users > `getWishlist`, `setWishlist`, `addWishlistItem`, `removeWishlistItem` — manage the current user's or guest's wishlist.
48
+
49
+ - Users > `ICartResponse`, `ICartItem`, `ICartSet`, `ICartAddItem`, `IWishlistResponse`, `IWishlistItem`, `IWishlistSet`, `IWishlistAddItem` — new interfaces.
50
+
51
+ - Blocks > `getCartComplement`, `getCartComplementByProductIds` — get "complete your cart" products (by cart context or explicit productIds).
52
+
53
+ - Blocks > `getCartSimilar`, `getCartSimilarByProductIds` — get "similar to cart" products (by cart context or explicit productIds).
54
+
55
+ - Blocks > `getWishlistSimilar`, `getWishlistSimilarByProductIds` — get "similar to wishlist" products (by wishlist context or explicit productIds).
56
+
57
+ - Blocks > `getPersonalRecommendations` — get personal recommendations for the user.
58
+
59
+ - Blocks > `getRecentlyViewed` — get recently viewed products.
60
+
61
+ - Blocks > `getRepeatPurchase` — get products for repeat purchase.
62
+
63
+ - Blocks > `getTrending` — get trending products of the block.
64
+
65
+ - Blocks > `getSlides` — get the block's slides tree as a flat pre-order array (slider_block only).
66
+
67
+ - Blocks > `IBlockProductsLookup`, `IContentSlidesResponse`, `IContentSlideItem` — new interfaces.
68
+
69
+ - Events > `getAllEvents` — get all available events.
70
+
71
+ - Events > `subscribeToForm`, `unsubscribeFromForm` — subscribe to / unsubscribe from form events by marker.
72
+
73
+ - Events > `getFormSubscriptions` — get all form subscriptions.
74
+
75
+ - Events > `IContentApiEvent`, `IListFormSubscription`, `ISubscribeFormEvent` — new interfaces.
76
+
77
+ - Products > `getProductsByVectorSearch` — semantic (vector) search for products.
78
+
79
+ - Products > `IVectorSearchProducts` — new interface.
80
+
81
+ - Guest mode — the SDK now sends an `x-guest-id` header on unauthenticated requests, enabling guest cart/wishlist/activity flows:
82
+ - `config.guestId` — optional explicit guest identifier in `defineOneEntry`.
83
+ - `setGuestId(guestId)` — set/clear the guest identifier at runtime (chainable, like `setAccessToken`; pass `''` to clear).
84
+ - 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.
85
+ - 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.
86
+ - The header is omitted for authenticated requests (when an access token is set).
87
+
88
+ ### What's Changed
89
+
90
+ - 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.
91
+
92
+ - Blocks > `getSimilarProducts` — added optional `productId` query parameter.
93
+
94
+ ## v.1.0.149
95
+
96
+ ### What's Changed
97
+
98
+ - Captcha fix.
99
+
100
+ ## v.1.0.148
101
+
102
+ ### What's Changed
103
+
104
+ - Small fixes.
105
+
106
+ ## v.1.0.147
107
+
108
+ ### What's Changed
109
+
110
+ - Small fixes.
111
+
112
+ ## v.1.0.146
113
+
114
+ ### What's Changed
115
+
116
+ - Small fixes.
117
+
118
+ ## v.1.0.145
119
+
120
+ ### What's Changed
121
+
122
+ - Small fixes.
123
+
124
+ ## v.1.0.144
125
+
126
+ ### What's New
127
+
128
+ - Blocks > `getFrequentlyOrderedProducts` — get frequently ordered products by block marker and product id.
129
+
130
+ - Blocks > `BlockType` — added `'frequently_ordered_block'` value.
131
+
132
+ - Discounts > `getBonusBalance` — get bonus balance of the current user.
133
+
134
+ - Discounts > `getBonusHistory` — get bonus transaction history with filtering by type, date range, discount, module and admin flag.
135
+
136
+ - Discounts > `IBonusTransactionEntity` — new interface for bonus transactions.
137
+
138
+ - Orders > `getRefunds` — get all refund requests for an order.
139
+
140
+ - Orders > `createRefundRequest` — create a refund request for an order.
141
+
142
+ - Orders > `cancelRefundRequest` — cancel a refund request for an order.
143
+
144
+ - Orders > `IRefundRequest` — new interface for refund requests.
145
+
146
+ - Orders > `IBaseOrdersEntity` — added `bonusAmount`, `bonusApplied`, `totalDue` fields.
147
+
148
+ - Orders > `IOrderData` — added `bonusAmount` field.
149
+
150
+ - Orders > `ICreateOrderPreview` — added `bonusAmount` field.
151
+
152
+ - Orders > `IOrderPreviewResponse` — added `bonusApplied`, `totalDue` fields.
153
+
154
+ - Products > `IAggregatedProductGroup` — new interface for aggregated product groups.
155
+
156
+ - Discounts > `IDiscountsEntity` — added `bonusEvent` field.
157
+
158
+ - Forms > `IFormConfig` — added `exceptionIds` field.
159
+
160
+ - Pages > `IPagesEntity` — added `rating` field.
161
+
162
+ - Products > `IProductsEntity` — added `rating` field.
163
+
164
+ - Users > `IUserEntity` — added `rating` field.
165
+
166
+ ### What's Changed
167
+
168
+ - Discounts > `IDiscountsEntity.type` — removed `'PERSONAL_BONUS'` value.
169
+
170
+ - Discounts > `getAllDiscounts` — removed `'PERSONAL_BONUS'` from type filter parameter.
171
+
172
+ - Forms > `IFormsEntity` — type narrowed to `'order' | 'sing_in_up' | 'collection' | 'data' | 'rating'`, removed `moduleFormConfigs` field.
173
+
174
+ - Products > `getProductsEmptyPage` — changed from GET to POST, added `body` parameter, return type changed to `IAggregatedProductGroup[]`.
175
+
176
+ ---
177
+
178
+ ## v.1.0.142
179
+
180
+ ### What's Changed
181
+
182
+ - Small fixes.
183
+
184
+ ### Bug Fixes
185
+
186
+ - `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.
187
+
188
+ - `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`.
189
+
190
+ - `AuthProviderApi.refresh()` — same fix: tokens and `saveFunction` are now only invoked on successful response, preventing accidental token destruction on refresh failure.
191
+
192
+ ---
193
+
194
+ ## v.1.0.140
195
+
196
+ ### What's New
197
+
198
+ - Discounts — new module with `getAllDiscounts`, `getDiscountByMarker` and `validateDiscountsCoupon` methods.
199
+
200
+ - Orders > `previewOrder` — preview order calculation with discounts and coupons (without saving).
201
+
202
+ - Orders > `getAllStatusesByStorageMarker` — get all statuses by storage marker.
203
+
204
+ - Orders > `IOrderData` — added `couponCode` and `additionalDiscountsMarkers` fields.
205
+
206
+ - Products > `getProductById` — added optional `isNormalized` parameter.
207
+
208
+ - Products > `IFilterParams` — added `pageUrls` field (array).
209
+
210
+ - Sitemap — new module with `updateSitemap` and `listSitemap` methods.
211
+
212
+ ### What's Changed
213
+
214
+ - Orders > `IBaseOrdersEntity` — added `couponCode`, `additionalDiscountsMarkers`, `discountConfig` fields.
215
+
216
+ - Orders > `IOrderByMarkerEntity` — added `statusLocalizeInfos` field.
217
+
218
+ - Orders > `getOrderByMarker` — renamed to `getOrdersStorageByMarker`.
219
+
220
+ ### What's Deleted
221
+
222
+ - System > validateCaptcha
223
+
224
+ ## v.1.0.139
225
+
226
+ ### What's Changed
227
+
228
+ - Small fixes.
229
+
230
+ ## v.1.0.138
231
+
232
+ ### What's New
233
+
234
+ - Added signPrice field to userQuery field for products
235
+
236
+ ### What's Changed
237
+
238
+ - Small fixes.
239
+
240
+ ## v.1.0.137
241
+
242
+ ### What's New
243
+
244
+ - Add Zod validation in critical modules
245
+
246
+ ### What's Changed
247
+
248
+ - rename "oauthSignUp" to "oauth"
249
+
250
+ - Small fixes.
251
+
252
+ ## v.1.0.136
253
+
254
+ ### What's New
255
+
256
+ - Add "timeIntervals" field to AttributeSets
257
+
258
+ - Add "timeIntervals" field to Forms attributes
259
+
260
+ ## v.1.0.135
261
+
262
+ ### What's New
263
+
264
+ - FormData > updateFormsDataByid - Update one object of form data by id.
265
+
266
+ - FormData > updateFormsDataStatusByid - Update one object of form data status by id.
267
+
268
+ - FormData > deleteFormsDataByid - Delete one object of form data by id.
269
+
270
+ ### What's Changed
271
+
272
+ - Small fixes.
273
+
274
+ ### What's Deleted
275
+
276
+ - Payments > webhookByMarker
277
+
278
+ ---
279
+
280
+ ## v.1.0.134
281
+
282
+ ### What's Changed
283
+
284
+ - Change formsData > getFormsDataByMarker - remove parameter isNested
285
+
286
+ - Change formsData > getFormsDataByMarker - add parameter isExtended
287
+
288
+ - Change formsData > getFormsDataByMarker - add body parameter entityparentIdentifier
289
+
290
+ ---
291
+
292
+ ## v.1.0.133
293
+
294
+ ### What's New
295
+
296
+ - FileUploading > createFileFromUrl - Utility method. Create a File object from a URL for uploading file or use with formData.
297
+
298
+ ### What's Changed
299
+
300
+ - Small fixes.
301
+
302
+ ### What's Deleted
303
+
304
+ - FormsData > getFormsData
305
+
306
+ ---
307
+
308
+ ## v.1.0.132
309
+
310
+ ### What's Changed
311
+
312
+ - Small fixes.
313
+
314
+ ---
315
+
316
+ ## v.1.0.131
317
+
318
+ ### What's Changed
319
+
320
+ - Small fixes.
321
+
322
+ ---
323
+
324
+ ## v.1.0.130
325
+
326
+ ### What's New
327
+
328
+ - Added `config.providerMarker` parameter to `defineOneentry` config
329
+
330
+ ---
331
+
332
+ ## v.1.0.129
333
+
334
+ ### What's Changed
335
+
336
+ - Small fixes.
337
+
338
+ ---
339
+
340
+ ## v.1.0.128
341
+
342
+ ### What's Changed
343
+
344
+ - Extend jsdoc comments.
345
+
346
+ - Small fixes.
347
+
348
+ ---
349
+
350
+ ## v.1.0.127
351
+
352
+ ### What's Changed
353
+
354
+ - Fixed some types errors. Improved fields descriptions.
355
+
356
+ ---
357
+
358
+ ## v.1.0.126
359
+
360
+ ### What's New
361
+
362
+ - AuthProvider > oauthSignUp - User registration (authorizati09on) via OAUTH.
363
+
364
+ - AuthProvider > logoutAll - Logout of user account on all devices.
365
+
366
+ - AuthProvider > getActiveSessionsByMarker - Getting active user session data.
367
+
368
+ - Payments > webhookByMarker - marker: This is a payment account marker.
369
+
370
+ - Products > getProductsCount - Getting the number of products for the entire catalog.
371
+
372
+ - Products > getProductsCountByPageId - Getting the number of products on a catalog page by page ID.
373
+
374
+ - Products > getProductsCountByPageUrl - Getting the number of products on a catalog page by page URL.
375
+
376
+ - System > getApiStat - Getting the number of requests to API
377
+
378
+ - Users > archiveUser - Archiving one user object (marked for deletion).
379
+
380
+ ### What's Deleted
381
+
382
+ - Payments > webhookStripe
383
+
384
+ - Payments > getConnected
385
+
386
+ - Pages > getFormsByPageUrl
387
+
388
+ ### What's Changed
389
+
390
+ - AuthProvider > getMarker reanmed to getAuthProviderByMarker
391
+
392
+ - FormData > postFormsData - changed the type of the input parameter body to IBodyPostFormData, changed output type to IPostFormResponse.
393
+
394
+ - FormData > getFormsDataByMarker - input parameters scheme changed, changed output type to IFormsByMarkerDataEntity.
395
+
396
+ - Payments > getAccountById - added payment account connection parameters to the settings field.
397
+
398
+ Example settings for stripe
399
+
400
+ ```json
401
+ {
402
+ "stripeAccountId": "acct_1RsDXzHy1QOsjfBI",
403
+ "stripeOnboardingComplete": true,
404
+ "stripePublishableKey": "pk_test_51OO...Y7MS3",
405
+ "successUrl": "https://example.com/success",
406
+ "cancelUrl": "https://example.com/cancel",
407
+ "sessionTimeout": 15
408
+ }
409
+ ```
410
+
411
+ Example settings for yookassa
412
+
413
+ ```json
414
+ {
415
+ "shopId": "1234567",
416
+ "secretKey": "test_pazk0r3JNlMEEwQq6t3Syk-qapXL0ArHvdXYxtaDvcv",
417
+ "successUrl": "https://example.com/success",
418
+ "cancelUrl": "https://example.com/cancel",
419
+ "sessionTimeout": 15
420
+ }
421
+ ```
422
+
423
+ ---
424
+
425
+ ## v.1.0.124
426
+
427
+ ### What's Changed
428
+
429
+ - Admins > getAdminsInfo - old sdk version won't work with new data
430
+
431
+ - FileUploading > getFile - Parameter 'filename' in query change into required
432
+
433
+ - FileUploading > delete - Parameter 'filename' in query change into required
434
+
435
+ - Products > getProductsByIds - Add ids in query / Delete ids in path
436
+
437
+ - AuthProvider > changePassword - Add new required field eventIdentifier
438
+
439
+ - Templates > getTemplateByType - Parameter 'type' in query change into not required
440
+
441
+ What's Deleted
442
+
443
+ - ProductStatuses > getProductStatusesById
444
+
445
+ - Templates > getTemplateById
446
+
447
+ - TemplatePreviews > getTemplatePreviewById
448
+
449
+ ---
450
+
451
+ ## v.1.0.0
452
+
453
+ 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 = {
@@ -7,6 +7,7 @@ export default class StateModule {
7
7
  url: string | undefined;
8
8
  lang: string | undefined;
9
9
  token: string | undefined;
10
+ guestId: string | undefined;
10
11
  accessToken: string | undefined;
11
12
  traficLimit: boolean;
12
13
  refreshToken: string | undefined;
@@ -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: `_getBrowserDeviceId()` — read from localStorage, stable across sessions.
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
  *