npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mikeci/pos-analytics-replay

v0.3.4

Published

Session replay wireframe helpers for the Pos Analytics React Native SDK.

Readme

@mikeci/pos-analytics-replay

Session replay cho app React Native: ghi cây component (không quay video, không gửi bitmap), che dữ liệu nhạy cảm, lưu hàng đợi trên máy và gửi lên collector theo protocol V2 (POST /v1/replay/chunks).

npm install @mikeci/pos-analytics-replay

Đã gỡ định dạng wireframe cũ. maskTree, applyFrames, buildChunk, shouldMask, maskText và mã chụp native WireframeCapture (Swift/Kotlin) không còn. Collector trả 410 replay_legacy_removed cho POST /v1/replay. App đang dùng định dạng cũ cần chuyển sang ReplayRecorder + ReplayUploader bên dưới.

Recorder

ReplayRecorder ghi snapshot, patch và tap/scroll theo protocol mới. Hàng đợi replay tách khỏi hàng đợi event. Input và component nhạy cảm được mask trước khi vào chunk. ReplayScreen, ReplayView, ReplayButton, ReplayText và ReplayInput đăng ký node. Sampling và kill switch lấy từ GET /v1/sdk/config.

Gửi replay lên collector

ReplayUploader lưu chunk xuống máy và gửi lên collector. Hàng đợi nằm trong AsyncStorage nên không mất khi app bị kill hoặc mất mạng.

import AsyncStorage from "@react-native-async-storage/async-storage";
import { ReplayRecorder, ReplayUploader, recorderOptionsFromConfig } from "@mikeci/pos-analytics-replay";

const uploader = new ReplayUploader({
  endpoint: "https://ingest.example.com",
  appId: "veso24h",
  writeKey: CLIENT_WRITE_KEY,
  environment: "production",
  storage: AsyncStorage,
  // compress: async (json) => pako.gzip(json), // tùy chọn: gửi gzip để tiết kiệm dữ liệu di động
});

// Chưa có mạng và chưa có cấu hình đã lưu thì trả enabled=false: không ghi, event vẫn gửi bình thường.
const config = await uploader.loadConfig();
const recorder = new ReplayRecorder({
  replayId,
  sessionId,
  viewport,
  ...recorderOptionsFromConfig(config),
});
const replay = uploader.attach(recorder); // tự tick() mỗi 150 ms, gửi mỗi 5 giây

// AppState: 'background' -> await replay.background(); 'active' -> replay.foreground();
// Rời session:                await replay.stop();   // gửi nốt hàng đợi và POST /v1/replay/end

Cách hoạt động:

| Tình huống | Hành vi | | --- | --- | | Mất mạng, 429, 5xx | Giữ chunk, thử lại theo backoff 5s → 15s → 30s → 1p → 5p (có jitter), dùng Retry-After nếu server gửi. Dừng ở chunk lỗi để giữ thứ tự. Quá maxAttempts (8) thì bỏ chunk | | 400, 401, 409, 413 | Bỏ chunk đó và gửi tiếp chunk sau (gửi lại cũng không thành công) | | 403 replay_disabled | Xóa hàng đợi, đặt uploader.isDisabled = true, không ghi thêm | | Hàng đợi quá maxChunks (30) hoặc maxBytes (2 MB) | Bỏ chunk cũ nhất | | Lỗi ghi storage | Bỏ chunk, không ném lỗi ra app |

Chunk đã gửi lại thì collector trả duplicate: true nên gửi lặp không tạo bản sao. Collector cũng mask lần hai dữ liệu cá nhân; SDK vẫn phải mask trước khi gửi.