Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/happy-balloons-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tma.js/sdk": patch
---

Save raw colors instead of computed ones when calling MiniApp's color setters.
4 changes: 2 additions & 2 deletions apps/docs/platform/authorizing-user.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ First of all, it is required to begin with the transmitting init data from the c
using this code:

```typescript
import { retrieveRawInitData } from '@telegram-apps/sdk'
import { retrieveRawInitData } from '@tma.js/sdk'

const initDataRaw = retrieveRawInitData()

Expand Down Expand Up @@ -37,7 +37,7 @@ authorizes the user.
The Node.js example uses [express](https://www.npmjs.com/package/express) to process HTTP requests.

```typescript
import { validate, parse, type InitData } from '@telegram-apps/init-data-node';
import { validate, parse, type InitData } from '@tma.js/init-data-node';
import express, {
type ErrorRequestHandler,
type RequestHandler,
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/platform/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ type and assign it to all 3 paths.
## Listening to Events

Handling all possible environments for a developer's application can be challenging. To simplify
this process, the community developed the [@telegram-apps/sdk](../packages/telegram-apps-sdk/2-x)
this process, the community developed the [@tma.js/sdk](../packages/tma-js-sdk)
package, which greatly eases integration.

Here's how to use it:

```ts
import { on } from '@telegram-apps/sdk';
import { on } from '@tma.js/sdk';

// Start listening to "viewport_changed" event. Returned value
// is a function, which removes this event listener.
Expand All @@ -97,7 +97,7 @@ removeListener();
```

You can learn more about calling methods in the
package's [documentation](../packages/telegram-apps-bridge/events.md#listening-to-events).
package's [documentation](../packages/tma-js-bridge/events.md#listening-to-events).

## Available Events

Expand Down
8 changes: 4 additions & 4 deletions apps/docs/platform/init-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ and init data specifically.
## Retrieving

To extract init data, a developer can use the `retrieveLaunchParams` function
from [@telegram-apps/sdk](../packages/telegram-apps-sdk/2-x).
from [@tma.js/sdk](../packages/tma-js-sdk).

```typescript
import { retrieveLaunchParams } from '@telegram-apps/sdk';
import { retrieveLaunchParams } from '@tma.js/sdk';

const { initDataRaw, initData } = retrieveLaunchParams();
```
Expand Down Expand Up @@ -52,7 +52,7 @@ carried out on the server side.
Here is how a developer could send init data to server:

```typescript
import { retrieveLaunchParams } from '@telegram-apps/sdk';
import { retrieveLaunchParams } from '@tma.js/sdk';

const { initDataRaw } = retrieveLaunchParams();

Expand Down Expand Up @@ -82,7 +82,7 @@ and used in the future code execution.
> [!TIP]
> To avoid possible problems related to the init data validation process, we recommend utilizing
> well-established and tested packages:
> - For Node: [@telegram-apps/init-data-node](../packages/telegram-apps-init-data-node)
> - For Node: [@tma.js/init-data-node](../packages/tma-js-init-data-node)
> - For GoLang: [init-data-golang](../packages/init-data-golang.md)

### Using Telegram Bot Token
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/platform/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ window.external.notify(data);
## Calling Methods

Handling all possible environments for a developer's application can be challenging. To simplify
this process, the community developed the [@telegram-apps/sdk](../packages/telegram-apps-sdk/2-x)
this process, the community developed the [@tma.js/sdk](../packages/tma-js-sdk)
package, which greatly eases integration.

Here's how to use it:

```ts
import { postEvent } from '@telegram-apps/sdk';
import { postEvent } from '@tma.js/sdk';

postEvent('web_app_set_header_color', { color_key: 'bg_color' });
```

You can learn more about calling methods in the
package's [documentation](../packages/telegram-apps-bridge/events.md#calling-methods).
package's [documentation](../packages/tma-js-bridge/events.md#calling-methods).

## Available Methods

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/platform/sticky-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Starting from the Mini Apps version **7.7**, you are able to prevent the applica
closing due to swipe down by using a special method.

- [Mini Apps method](methods.md#web-app-setup-swipe-behavior)
- [@telegram-apps/sdk component](../packages/telegram-apps-sdk/2-x/components/swipe-behavior.md)
- [@tma.js/sdk component](../packages/tma-js-sdk/features/swipe-behavior)

:::

Expand Down Expand Up @@ -74,7 +74,7 @@ Here is the HTML and CSS you can use:
My application goes here.
</div>
</div>
<script src="https://unpkg.com/@telegram-apps/sdk@1.0.0/dist/index.iife.js"></script>
<script src="https://unpkg.com/@tma.js/sdk@3.1.0/dist/index.iife.js"></script>
<script>
(function() {
var { retrieveLaunchParams, postEvent } = window.telegramApps.sdk;
Expand All @@ -101,4 +101,4 @@ Using this HTML and CSS will prevent most accidental swipe-down closures. While
most scenarios, there are rare cases where it may not be effective, but these are uncommon in
real-world usage.

[Open in Telegram](https://t.me/tmajsbot/sticky_app) ([Source code](https://github.com/Telegram-Mini-Apps/sticky-app/blob/master/dist/index.html))
[Open in Telegram](https://t.me/tmajsbot/sticky_app) ([Source code](https://github.com/Telegram-Mini-Apps/sticky-app/blob/master/dist/index.html))
2 changes: 1 addition & 1 deletion packages/sdk/src/features/MiniApp/MiniApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class MiniApp {
? postEvent(method, { color: rgb })
: E.left(new UnknownThemeParamsKeyError(color)),
E.map(() => {
stateful.setState({ [stateKey]: rgb });
stateful.setState({ [stateKey]: color });
}),
);
},
Expand Down