@smartico/public-api 0.0.388 → 0.0.390

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.
@@ -10,6 +10,11 @@ interface RafflePrizePublicMeta {
10
10
  * Indicates whether the chance to win should be hidden in the UI.
11
11
  */
12
12
  hide_chance_to_win: boolean;
13
+ /**
14
+ * Custom data field set in the backoffice prize setup.
15
+ * Can be used to build custom UI for gamification.
16
+ */
17
+ custom_data?: string;
13
18
  }
14
19
  /**
15
20
  * Represents a prize in a draw.
@@ -195,7 +195,6 @@ declare class SmarticoAPI {
195
195
  avatarsGetPrompts(user_ext_id: string): Promise<GetAvatarPromptsResponse>;
196
196
  avatarSetAvatar(user_ext_id: string, avatar_id: string, avatar_real_id: number): Promise<SetAvatarResponse>;
197
197
  avatarsCustomize(params: {
198
- label_id: number;
199
198
  user_id: number;
200
199
  prompt_id: number;
201
200
  avatar_url: string;
@@ -354,7 +354,6 @@ export declare class WSAPIAvatars extends WSAPIMiniGames {
354
354
  *
355
355
  * **Visitor mode**: not supported (throws).
356
356
  *
357
- * @param props.label_id Numeric Smartico label (brand) ID the user belongs to.
358
357
  * @param props.user_id Numeric Smartico user ID.
359
358
  * @param props.prompt_id Style-prompt ID (`prompt_id`) from {@link getAvatarPrompts}.
360
359
  * @param props.avatar_url CDN URL of the base avatar to customize.
@@ -364,13 +363,12 @@ export declare class WSAPIAvatars extends WSAPIMiniGames {
364
363
  *
365
364
  * @example
366
365
  * ```ts
367
- * // label_id / user_id identify the Smartico user being customized.
366
+ * // user_id identifies the Smartico user being customized.
368
367
  * const prompts = await window._smartico.api.getAvatarPrompts();
369
368
  * const prompt = prompts[0];
370
369
  *
371
370
  * console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
372
371
  * const result = await window._smartico.api.avatarsCustomize({
373
- * label_id,
374
372
  * user_id,
375
373
  * prompt_id: prompt.prompt_id,
376
374
  * avatar_url: baseAvatar.avatar_url,
@@ -390,7 +388,6 @@ export declare class WSAPIAvatars extends WSAPIMiniGames {
390
388
  * ```
391
389
  */
392
390
  avatarsCustomize(props: {
393
- label_id: number;
394
391
  user_id: number;
395
392
  prompt_id: number;
396
393
  avatar_url: string;
package/dist/index.js CHANGED
@@ -8117,7 +8117,6 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
8117
8117
  *
8118
8118
  * **Visitor mode**: not supported (throws).
8119
8119
  *
8120
- * @param props.label_id Numeric Smartico label (brand) ID the user belongs to.
8121
8120
  * @param props.user_id Numeric Smartico user ID.
8122
8121
  * @param props.prompt_id Style-prompt ID (`prompt_id`) from {@link getAvatarPrompts}.
8123
8122
  * @param props.avatar_url CDN URL of the base avatar to customize.
@@ -8127,13 +8126,12 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
8127
8126
  *
8128
8127
  * @example
8129
8128
  * ```ts
8130
- * // label_id / user_id identify the Smartico user being customized.
8129
+ * // user_id identifies the Smartico user being customized.
8131
8130
  * const prompts = await window._smartico.api.getAvatarPrompts();
8132
8131
  * const prompt = prompts[0];
8133
8132
  *
8134
8133
  * console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
8135
8134
  * const result = await window._smartico.api.avatarsCustomize({
8136
- * label_id,
8137
8135
  * user_id,
8138
8136
  * prompt_id: prompt.prompt_id,
8139
8137
  * avatar_url: baseAvatar.avatar_url,
@@ -8156,7 +8154,7 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
8156
8154
  _proto.avatarsCustomize = function avatarsCustomize(props) {
8157
8155
  try {
8158
8156
  var _this5 = this;
8159
- var required = ['label_id', 'user_id', 'prompt_id', 'avatar_url', 'avatar_real_id'];
8157
+ var required = ['user_id', 'prompt_id', 'avatar_url', 'avatar_real_id'];
8160
8158
  for (var _i = 0, _required = required; _i < _required.length; _i++) {
8161
8159
  var field = _required[_i];
8162
8160
  if (!props[field]) {
@@ -11838,7 +11836,8 @@ var SmarticoAPI = /*#__PURE__*/function () {
11838
11836
  return Promise.resolve(_this89.sendAvatarApi({
11839
11837
  method: 'avatar-customize',
11840
11838
  body: {
11841
- label_id: params.label_id,
11839
+ // The server resolves label_id from label_api_key.
11840
+ label_api_key: _this89.label_api_key,
11842
11841
  user_id: params.user_id,
11843
11842
  user_ext_id: (_this89$tracker = _this89.tracker) == null ? void 0 : _this89$tracker.getExtUserId(),
11844
11843
  brand_key: _this89.brand_api_key || ((_this89$tracker2 = _this89.tracker) == null || (_this89$tracker2 = _this89$tracker2.params) == null ? void 0 : _this89$tracker2.brand_key),