| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | |
| 11 | 11 | namespace WCPOS\WooCommercePOS\Templates; |
| 12 | 12 | |
| 13 | 13 | use WCPOS\WooCommercePOS\Services\Auth; |
| 14 | +use WCPOS\WooCommercePOS\Services\Cashier; | |
| 14 | 15 | use WCPOS\WooCommercePOS\Services\Lifecycle_Events; |
| 15 | 16 | use WCPOS\WooCommercePOS\Services\Settings; |
| 16 | 17 | use WCPOS\WooCommercePOS\Sync\Pos_Uuid; |
| 17 | 18 | use WCPOS\WooCommercePOS\Template_Router; |
| @@ -53,11 +54,11 @@ | ||
| 53 | 54 | auth_redirect(); |
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | // check privileges. |
| 57 | - if ( ! current_user_can( 'access_woocommerce_pos' ) ) { | |
| 58 | - // translators: Authorization error shown when a logged-in user lacks permission to open the POS page. | |
| 59 | - wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'woocommerce-pos' ) ); | |
| 58 | + $user = wp_get_current_user(); | |
| 59 | + if ( ! Cashier::instance()->can_open_pos( $user ) ) { | |
| 60 | + wp_die( esc_html( Cashier::instance()->missing_pos_capabilities_message( $user ) ), '', array( 'response' => 403 ) ); | |
| 60 | 61 | } |
| 61 | 62 | |
| 62 | 63 | // disable cache plugins. |
| 63 | 64 | $this->no_cache(); |
| @@ -154,8 +155,18 @@ | ||
| 154 | 155 | |
| 155 | 156 | // Default to the plugin's own major.minor so the stable lane tracks the |
| 156 | 157 | // version automatically: a 1.9.x plugin loads `@1.9`, a 1.10.x plugin loads |
| 157 | 158 | // `@1.10`, etc. — no edit needed as versions roll. |
| 159 | + | |
| 160 | + /* | |
| 161 | + * One jsDelivr ref per lane, named after the lane (owner ruling, 2026-09-04): | |
| 162 | + * released lane → `@<major.minor>` (this default; the tag is cut at release) | |
| 163 | + * next lane → `@next` — the `next` BRANCH of wcpos/web-bundle IS the dev | |
| 164 | + * lane's tag. There is no versioned/prerelease tag for `next`. | |
| 165 | + * dev-next sets WCPOS_WEB_BUNDLE_REF=next to load it. | |
| 166 | + */ | |
| 167 | + // When `next` becomes `main`, the released ref simply becomes the new | |
| 168 | + // major.minor (e.g. `@1.11`) via this default. | |
| 158 | 169 | $default_bundle_ref = implode( '.', \array_slice( explode( '.', VERSION ), 0, 2 ) ); |
| 159 | 170 | |
| 160 | 171 | /** |
| 161 | 172 | * The web-bundle ref served from jsDelivr (or a full base URL). |
| @@ -161,10 +172,12 @@ | ||
| 161 | 172 | * The web-bundle ref served from jsDelivr (or a full base URL). |
| 162 | 173 | * |
| 163 | 174 | * Override via the WCPOS_WEB_BUNDLE_REF constant / env var or this filter to |
| 164 | 175 | * point a site at another lane for testing the in-development build locally |
| 165 | - * or on staging: a branch (e.g. `next`), a tag, a commit, or a full base URL | |
| 166 | - * (anything containing `://`, e.g. a local dev server or an EAS preview). | |
| 176 | + * or on staging: the `next` lane's ref is the branch `next` | |
| 177 | + * (https://cdn.jsdelivr.net/gh/wcpos/web-bundle@next); a tag, a commit, or a | |
| 178 | + * full base URL (anything containing `://`, e.g. a local dev server or an EAS | |
| 179 | + * preview) also work. | |
| 167 | 180 | * |
| 168 | 181 | * @hook woocommerce_pos_web_bundle_ref |
| 169 | 182 | */ |
| 170 | 183 | $bundle_ref = (string) apply_filters( 'woocommerce_pos_web_bundle_ref', $explicit_bundle_ref ?? $default_bundle_ref ); |