@opentabs-dev/opentabs-plugin-panda-express 0.0.74

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 (89) hide show
  1. package/README.md +140 -0
  2. package/dist/adapter.iife.js +15117 -0
  3. package/dist/adapter.iife.js.map +7 -0
  4. package/dist/index.d.ts +14 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +58 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/panda-api.d.ts +9 -0
  9. package/dist/panda-api.d.ts.map +1 -0
  10. package/dist/panda-api.js +88 -0
  11. package/dist/panda-api.js.map +1 -0
  12. package/dist/tools/add-product-to-basket.d.ts +21 -0
  13. package/dist/tools/add-product-to-basket.d.ts.map +1 -0
  14. package/dist/tools/add-product-to-basket.js +39 -0
  15. package/dist/tools/add-product-to-basket.js.map +1 -0
  16. package/dist/tools/apply-coupon.d.ts +19 -0
  17. package/dist/tools/apply-coupon.d.ts.map +1 -0
  18. package/dist/tools/apply-coupon.js +27 -0
  19. package/dist/tools/apply-coupon.js.map +1 -0
  20. package/dist/tools/cancel-order.d.ts +7 -0
  21. package/dist/tools/cancel-order.d.ts.map +1 -0
  22. package/dist/tools/cancel-order.js +25 -0
  23. package/dist/tools/cancel-order.js.map +1 -0
  24. package/dist/tools/create-basket.d.ts +19 -0
  25. package/dist/tools/create-basket.d.ts.map +1 -0
  26. package/dist/tools/create-basket.js +30 -0
  27. package/dist/tools/create-basket.js.map +1 -0
  28. package/dist/tools/find-restaurants.d.ts +28 -0
  29. package/dist/tools/find-restaurants.d.ts.map +1 -0
  30. package/dist/tools/find-restaurants.js +33 -0
  31. package/dist/tools/find-restaurants.js.map +1 -0
  32. package/dist/tools/get-basket.d.ts +25 -0
  33. package/dist/tools/get-basket.d.ts.map +1 -0
  34. package/dist/tools/get-basket.js +27 -0
  35. package/dist/tools/get-basket.js.map +1 -0
  36. package/dist/tools/get-billing-accounts.d.ts +11 -0
  37. package/dist/tools/get-billing-accounts.d.ts.map +1 -0
  38. package/dist/tools/get-billing-accounts.js +35 -0
  39. package/dist/tools/get-billing-accounts.js.map +1 -0
  40. package/dist/tools/get-checkout-summary.d.ts +13 -0
  41. package/dist/tools/get-checkout-summary.d.ts.map +1 -0
  42. package/dist/tools/get-checkout-summary.js +40 -0
  43. package/dist/tools/get-checkout-summary.js.map +1 -0
  44. package/dist/tools/get-favorites.d.ts +9 -0
  45. package/dist/tools/get-favorites.d.ts.map +1 -0
  46. package/dist/tools/get-favorites.js +22 -0
  47. package/dist/tools/get-favorites.js.map +1 -0
  48. package/dist/tools/get-loyalty-rewards.d.ts +12 -0
  49. package/dist/tools/get-loyalty-rewards.d.ts.map +1 -0
  50. package/dist/tools/get-loyalty-rewards.js +33 -0
  51. package/dist/tools/get-loyalty-rewards.js.map +1 -0
  52. package/dist/tools/get-product-modifiers.d.ts +17 -0
  53. package/dist/tools/get-product-modifiers.d.ts.map +1 -0
  54. package/dist/tools/get-product-modifiers.js +45 -0
  55. package/dist/tools/get-product-modifiers.js.map +1 -0
  56. package/dist/tools/get-recent-orders.d.ts +17 -0
  57. package/dist/tools/get-recent-orders.d.ts.map +1 -0
  58. package/dist/tools/get-recent-orders.js +22 -0
  59. package/dist/tools/get-recent-orders.js.map +1 -0
  60. package/dist/tools/get-restaurant-menu.d.ts +22 -0
  61. package/dist/tools/get-restaurant-menu.d.ts.map +1 -0
  62. package/dist/tools/get-restaurant-menu.js +27 -0
  63. package/dist/tools/get-restaurant-menu.js.map +1 -0
  64. package/dist/tools/get-restaurant.d.ts +26 -0
  65. package/dist/tools/get-restaurant.d.ts.map +1 -0
  66. package/dist/tools/get-restaurant.js +34 -0
  67. package/dist/tools/get-restaurant.js.map +1 -0
  68. package/dist/tools/get-user-profile.d.ts +11 -0
  69. package/dist/tools/get-user-profile.d.ts.map +1 -0
  70. package/dist/tools/get-user-profile.js +48 -0
  71. package/dist/tools/get-user-profile.js.map +1 -0
  72. package/dist/tools/navigate-to-checkout.d.ts +32 -0
  73. package/dist/tools/navigate-to-checkout.d.ts.map +1 -0
  74. package/dist/tools/navigate-to-checkout.js +112 -0
  75. package/dist/tools/navigate-to-checkout.js.map +1 -0
  76. package/dist/tools/remove-coupon.d.ts +18 -0
  77. package/dist/tools/remove-coupon.d.ts.map +1 -0
  78. package/dist/tools/remove-coupon.js +25 -0
  79. package/dist/tools/remove-coupon.js.map +1 -0
  80. package/dist/tools/schemas.d.ts +241 -0
  81. package/dist/tools/schemas.d.ts.map +1 -0
  82. package/dist/tools/schemas.js +168 -0
  83. package/dist/tools/schemas.js.map +1 -0
  84. package/dist/tools/update-product-quantity.d.ts +20 -0
  85. package/dist/tools/update-product-quantity.d.ts.map +1 -0
  86. package/dist/tools/update-product-quantity.js +34 -0
  87. package/dist/tools/update-product-quantity.js.map +1 -0
  88. package/dist/tools.json +1584 -0
  89. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ # opentabs-plugin-panda-express
2
+
3
+ OpenTabs plugin for Panda Express — search restaurants, browse menus, build orders, manage loyalty rewards, and view order history.
4
+
5
+ ## Tools (18)
6
+
7
+ ### Restaurants
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `find_restaurants` | Search for nearby Panda Express locations by coordinates |
12
+ | `get_restaurant` | Get restaurant details by slug or external reference number |
13
+ | `get_restaurant_menu` | Get the full menu for a restaurant (categories + products) |
14
+ | `get_product_modifiers` | Get customization options for a menu item (sides, entrees, drinks, sizes) |
15
+
16
+ ### Orders
17
+
18
+ | Tool | Description |
19
+ |------|-------------|
20
+ | `create_basket` | Start a new order at a restaurant |
21
+ | `get_basket` | View basket contents, products, and totals |
22
+ | `add_product_to_basket` | Add a menu item with modifier selections |
23
+ | `update_product_quantity` | Change quantity of an item (set to 0 to remove) |
24
+ | `apply_coupon` | Apply a coupon code to the basket |
25
+ | `remove_coupon` | Remove a coupon from the basket |
26
+ | `get_checkout_summary` | Validate basket and review totals before checkout |
27
+ | `navigate_to_checkout` | Sync basket to browser and open the bag/checkout page |
28
+ | `cancel_order` | Cancel a previously submitted order |
29
+
30
+ ### Account
31
+
32
+ | Tool | Description |
33
+ |------|-------------|
34
+ | `get_user_profile` | View name, email, and loyalty membership status |
35
+ | `get_recent_orders` | View past order history |
36
+ | `get_favorites` | View saved favorite orders |
37
+ | `get_billing_accounts` | View saved payment methods |
38
+
39
+ ### Loyalty
40
+
41
+ | Tool | Description |
42
+ |------|-------------|
43
+ | `get_loyalty_rewards` | View available rewards and current points balance |
44
+
45
+ ## Ordering Flow
46
+
47
+ The AI handles everything except payment. The user's only action is selecting a payment method and tapping "Place Order".
48
+
49
+ ```
50
+ find_restaurants → get_restaurant_menu → get_product_modifiers
51
+
52
+ create_basket → add_product_to_basket → get_checkout_summary
53
+
54
+ navigate_to_checkout
55
+
56
+ (user selects payment & places order)
57
+ ```
58
+
59
+ ### Step by step
60
+
61
+ 1. **Find a restaurant** — use `find_restaurants` with lat/lng coordinates
62
+ 2. **Browse the menu** — use `get_restaurant_menu` with the restaurant ID
63
+ 3. **Check modifiers** — use `get_product_modifiers` for any product. Most items (bowls, plates, combos) require modifier selections (side choice, entree choice, drink choice). Simple items like bottled drinks only need a size option.
64
+ 4. **Create a basket** — use `create_basket` with the restaurant ID
65
+ 5. **Add items** — use `add_product_to_basket` with the product ID and selected option IDs from step 3
66
+ 6. **Review totals** — use `get_checkout_summary` to validate the basket and see subtotal, tax, and estimated ready time
67
+ 7. **Navigate to checkout** — use `navigate_to_checkout` to sync the basket into the browser session and open the bag page. The user then clicks CHECKOUT on the bag page to reach the payment screen.
68
+
69
+ ### How `navigate_to_checkout` works
70
+
71
+ The Panda Express website is an Ionic/Angular SPA that stores the active basket in a Redux persist store (`localStorage persist:root`). The `navigate_to_checkout` tool:
72
+
73
+ 1. Fetches the full basket from the Olo API
74
+ 2. Resolves the restaurant name and external reference number
75
+ 3. Writes the basket into the app's Redux persist store (same format the SPA uses)
76
+ 4. Navigates to `/order/my-bag` — the bag page where the order is displayed
77
+
78
+ From the bag page, the user clicks CHECKOUT to reach the payment screen. Direct navigation to `/order/checkout` does not work — the SPA's checkout component requires initialization from the bag page.
79
+
80
+ **Important:** The Panda Express tab must be focused (visible in the foreground) for the SPA to fully render after navigation. Chrome throttles background tabs, which prevents the Ionic framework from hydrating.
81
+
82
+ ### Basket visibility
83
+
84
+ Baskets created via `create_basket` are new server-side baskets. They become visible on the website through `navigate_to_checkout`, which syncs the basket into the browser's Redux state. Without calling `navigate_to_checkout`, the user would need to manually refresh the page.
85
+
86
+ Alternatively, to modify the user's existing bag (the one they already see on the website), read the basket ID from Redux state (`appState.basket.id`) and pass it to `get_basket`, `add_product_to_basket`, etc. Changes via the API appear after refreshing the bag page.
87
+
88
+ ### Modifiers are required for most products
89
+
90
+ Nearly every menu item requires modifier selections:
91
+
92
+ - **Combos** (Bowl, Plate, Bigger Plate) — choose a side and entrees
93
+ - **Panda Cub Meals** — choose side, entree, and drink
94
+ - **A La Carte items** — choose a size (Small, Medium, Large)
95
+ - **Drinks** — choose a size or container type
96
+ - **Appetizers** — choose quantity size (e.g., Small 1pc, Large 6pcs)
97
+
98
+ Always call `get_product_modifiers` before `add_product_to_basket`. Pass the selected option IDs as the `options` array. If mandatory modifiers are missing, the API returns a validation error.
99
+
100
+ ## Limitations
101
+
102
+ ### No payment submission
103
+
104
+ The plugin cannot submit payment. Payment requires credit card tokenization through a PCI-compliant proxy (Braintree/Cardinal). The supported payment methods — Credit Card, Gift Card, Apple Pay, PayPal, Venmo — all require browser-side payment flows.
105
+
106
+ The `navigate_to_checkout` tool bridges this gap: the AI builds the entire order via API, then hands off to the user at the payment screen.
107
+
108
+ ### No delivery address management
109
+
110
+ Setting delivery addresses requires endpoints that are not proxied through the same origin. Orders default to pickup mode.
111
+
112
+ ### SPA navigation constraints
113
+
114
+ - The checkout page (`/order/checkout`) cannot be loaded directly — it must be reached via the bag page (`/order/my-bag`) through the SPA's internal router.
115
+ - The Panda Express tab must be in the foreground for the SPA to render after navigation. Chrome throttles background tabs.
116
+
117
+ ### Cancel order timing
118
+
119
+ `cancel_order` only works for orders that have not yet been prepared. Completed orders cannot be cancelled. Old order IDs may expire from the Olo system.
120
+
121
+ ## Authentication
122
+
123
+ The plugin reads auth state from `localStorage` (`persist:root` key, Redux persist store). The `authtoken` field is used as a path segment for user-specific API endpoints (e.g., `/users/{authtoken}/recentorders`).
124
+
125
+ The user must be logged in on pandaexpress.com for account-related tools to work. Restaurant search, menu browsing, and basket creation work without authentication.
126
+
127
+ ## API
128
+
129
+ Panda Express uses [Olo (NomNom)](https://www.olo.com/) for online ordering, proxied through the same origin at `pandaexpress.com`. Key endpoint patterns:
130
+
131
+ - `/restaurants/near?lat=...&long=...` — restaurant search
132
+ - `/restaurants/{id}/menu` — restaurant menu
133
+ - `/products/{id}/modifiers` — product modifier options
134
+ - `/baskets/create` — create basket
135
+ - `/baskets/{id}/products` — add/modify products
136
+ - `/baskets/{id}/validate` — checkout validation
137
+ - `/users/{authtoken}/recentorders` — order history
138
+ - `/orders/{id}/cancel` — cancel order
139
+
140
+ Loyalty rewards data comes from the Punchh integration, read from the Redux persist store rather than API calls.