
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
book-now-sdk
Advanced tools
請在你的 HTML 頁面的 <head> 區塊加入以下 script 標籤:
<script src="https://cdn.jsdelivr.net/npm/book-now-sdk@1.0.14/dist/tripguru-sdk.js"></script>
在你的應用程式初始化或掛載時呼叫 TripGuruSDK.init 來設定必要參數:
TripGuruSDK.init({
apiKey: "你的 apiKey",
onError: (err) => {
// api key 錯誤時報錯
console.log("on error", err.code, err.message);
},
});
apiKey:由 TripGuru 提供的 API 金鑰,用於驗證和授權。onSuccess:購買成功後的回調函數。onError:錯誤回調,包含錯誤碼與訊息。在你的 HTML 中,將想要觸發購買流程的按鈕,加上以下自訂屬性:
<button data-tripguru-btn data-product-id="2" data-product-type="tour">
Buy Product 002
</button>
<button data-tripguru-btn data-product-id="3" data-product-type="activity">
Buy Product 003
</button>
data-tripguru-btn:標示此按鈕為 SDK 綁定目標。data-product-id:要購買的商品 ID,請替換成實際的產品編號。當使用者點擊按鈕時,SDK 會自動開啟一個 iframe modal,進行結帳流程。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>TripGuru SDK Demo</title>
<script src="https://cdn.jsdelivr.net/npm/book-now-sdk@1.0.14/dist/tripguru-sdk.js"></script>
</head>
<body>
<button
className="bg-primary rounded-lg text-white p-2"
data-tripguru-btn1.0.1
data-product-id="2"
>
Buy Product 002
</button>
<button
className="bg-primary rounded-lg text-white p-2 ml-2"
data-tripguru-btn
data-product-id="3"
>
Buy Product 003
</button>
<script>
TripGuruSDK.init({
apiKey: "your_api_key_here",
onSuccess: () => {
console.log("Purchase succeeded!");
},
onError: (err) => {
console.error("Purchase failed:", err.code, err.message);
},
});
</script>
</body>
</html>
FAQs
## 1. 引入 SDK 腳本
The npm package book-now-sdk receives a total of 1 weekly downloads. As such, book-now-sdk popularity was classified as not popular.
We found that book-now-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.