@zappar/zappar-cv 3.0.1-beta.0 → 3.0.1-beta.1

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.
package/README.md CHANGED
@@ -18,8 +18,8 @@ npm i @zappar/zappar-cv
18
18
 
19
19
  You can use our CDN from within your HTML:
20
20
  ```
21
- <script src="https://libs.zappar.com/zappar-cv/3.0.1-beta.0/zappar-cv.js"></script>
21
+ <script src="https://libs.zappar.com/zappar-cv/3.0.1-beta.1/zappar-cv.js"></script>
22
22
  ```
23
23
 
24
24
  Or you can download and host our standalone JavaScript bundle:
25
- [https://libs.zappar.com/zappar-cv/3.0.1-beta.0/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.0.1-beta.0/zappar-cv.zip)
25
+ [https://libs.zappar.com/zappar-cv/3.0.1-beta.1/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.0.1-beta.1/zappar-cv.zip)
@@ -3,6 +3,18 @@ import { zappar_face_mesh_t, zappar_face_tracker_t, zappar_world_tracker_t, zapp
3
3
  export declare type zappar_html_element_source_t = number & {
4
4
  _: 'zappar_html_element_source_t';
5
5
  };
6
+ export interface PermissionRequestUIOptions {
7
+ title?: string;
8
+ description?: string;
9
+ button?: string;
10
+ }
11
+ export interface PermissionDeniedUIOptions {
12
+ title?: string;
13
+ descriptionIOS?: string;
14
+ descriptionChrome?: string;
15
+ description?: string;
16
+ button?: string;
17
+ }
6
18
  export interface Additional {
7
19
  pipeline_gl_context_set(pipeline: zappar_pipeline_t, gl: WebGLRenderingContext, texturePool?: WebGLTexture[]): void;
8
20
  pipeline_gl_context_lost(pipeline: zappar_pipeline_t): void;
@@ -22,7 +34,8 @@ export interface Additional {
22
34
  face_mesh_load_default_full_head_simplified(o: zappar_face_mesh_t, fillMouth: boolean, fillEyeL: boolean, fillEyeR: boolean, fillNeck: boolean): Promise<void>;
23
35
  face_tracker_model_load_default(o: zappar_face_tracker_t): Promise<void>;
24
36
  pipeline_camera_frame_draw_gl(pipeline: zappar_pipeline_t, screenWidth: number, screenHeight: number, mirror?: boolean): void;
25
- permission_request_ui_promise(): Promise<boolean>;
37
+ permission_request_ui_promise(options?: PermissionRequestUIOptions): Promise<boolean>;
38
+ permission_denied_ui(options?: PermissionDeniedUIOptions): void;
26
39
  html_element_source_create(pipeline: zappar_pipeline_t, element: HTMLVideoElement | HTMLImageElement): zappar_html_element_source_t;
27
40
  html_element_source_start(o: zappar_html_element_source_t): void;
28
41
  html_element_source_pause(o: zappar_html_element_source_t): void;
@@ -1,3 +1,4 @@
1
+ import { PermissionDeniedUIOptions, PermissionRequestUIOptions } from "./additional";
1
2
  export declare function permissionGrantedCamera(): boolean;
2
3
  export declare function permissionGrantedMotion(): boolean;
3
4
  export declare function permissionDeniedCamera(): boolean;
@@ -7,5 +8,5 @@ export declare function permissionGrantedAll(): boolean;
7
8
  export declare function permissionRequestAll(): Promise<void>;
8
9
  export declare function permissionRequestCamera(): Promise<void>;
9
10
  export declare function permissionRequestMotion(): Promise<false | undefined>;
10
- export declare function permissionRequestUI(): Promise<boolean>;
11
- export declare function permissionDeniedUI(): void;
11
+ export declare function permissionRequestUI(options?: PermissionRequestUIOptions): Promise<boolean>;
12
+ export declare function permissionDeniedUI(options?: PermissionDeniedUIOptions): void;
package/lib/permission.js CHANGED
@@ -74,7 +74,8 @@ export function permissionRequestMotion() {
74
74
  _permissionDeniedMotion = false;
75
75
  });
76
76
  }
77
- export function permissionRequestUI() {
77
+ export function permissionRequestUI(options) {
78
+ var _a, _b, _c;
78
79
  return __awaiter(this, void 0, void 0, function* () {
79
80
  yield checkForCameraPermission();
80
81
  if (permissionGrantedAll()) {
@@ -136,9 +137,9 @@ export function permissionRequestUI() {
136
137
  }
137
138
  </style>
138
139
  <div class="zappar-inner">
139
- <div class="zappar-title">${tr(STRINGS.PermissionTitle)}</div>
140
- <div class="zappar-text">${tr(STRINGS.PermissionDescription)}</div>
141
- <button id="zappar-permission-request-button">${tr(STRINGS.PermissionButton)}</button>
140
+ <div class="zappar-title">${(_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : tr(STRINGS.PermissionTitle)}</div>
141
+ <div class="zappar-text">${(_b = options === null || options === void 0 ? void 0 : options.description) !== null && _b !== void 0 ? _b : tr(STRINGS.PermissionDescription)}</div>
142
+ <button id="zappar-permission-request-button">${(_c = options === null || options === void 0 ? void 0 : options.button) !== null && _c !== void 0 ? _c : tr(STRINGS.PermissionButton)}</button>
142
143
  </div>
143
144
  `;
144
145
  document.body.append(div);
@@ -176,17 +177,18 @@ export function permissionRequestUI() {
176
177
  function nextFrame() {
177
178
  return new Promise(resolve => requestAnimationFrame(() => resolve()));
178
179
  }
179
- export function permissionDeniedUI() {
180
+ export function permissionDeniedUI(options) {
180
181
  switch (parser.getBrowser().name) {
181
182
  case "Chrome":
182
- permissionDeniedUIChrome();
183
+ permissionDeniedUIChrome(options);
183
184
  break;
184
185
  default:
185
- permissionDeniedUIIOS();
186
+ permissionDeniedUIIOS(options);
186
187
  break;
187
188
  }
188
189
  }
189
- function permissionDeniedUIIOS() {
190
+ function permissionDeniedUIIOS(options) {
191
+ var _a, _b, _c, _d;
190
192
  let div = document.createElement("div");
191
193
  div.classList.add("zappar-permission-request");
192
194
  div.innerHTML = `
@@ -228,16 +230,17 @@ function permissionDeniedUIIOS() {
228
230
  }
229
231
  </style>
230
232
  <div class="zappar-inner">
231
- <div class="zappar-title">Permission is Needed</div>
232
- <div class="zappar-text">Permission to access your device's camera and motion sensors is necessary for this experience. Please reload the page to try again.</div>
233
- <button id="zappar-permission-reload-button">Reload</button>
233
+ <div class="zappar-title">${(_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : 'Permission is Needed'}</div>
234
+ <div class="zappar-text">${(_c = (_b = options === null || options === void 0 ? void 0 : options.descriptionIOS) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.description) !== null && _c !== void 0 ? _c : "Permission to access your device's camera and motion sensors is necessary for this experience. Please reload the page to try again."}</div>
235
+ <button id="zappar-permission-reload-button">${(_d = options === null || options === void 0 ? void 0 : options.button) !== null && _d !== void 0 ? _d : 'Reload'}</button>
234
236
  </div>
235
237
  `;
236
238
  document.body.append(div);
237
239
  let button = div.querySelector("#zappar-permission-reload-button");
238
240
  button === null || button === void 0 ? void 0 : button.addEventListener("click", () => window.location.reload());
239
241
  }
240
- function permissionDeniedUIChrome() {
242
+ function permissionDeniedUIChrome(options) {
243
+ var _a, _b, _c, _d;
241
244
  let div = document.createElement("div");
242
245
  div.classList.add("zappar-permission-request");
243
246
  div.innerHTML = `
@@ -279,9 +282,9 @@ function permissionDeniedUIChrome() {
279
282
  }
280
283
  </style>
281
284
  <div class="zappar-inner">
282
- <div class="zappar-title">Permission is Needed</div>
283
- <div class="zappar-text">Permission to access your device's camera and motion sensors is necessary for this experience.<br/><br/>To grant access, please tap the <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="white"><path d="M696-144q-60.48 0-102.24-41.76T552-288q0-60.48 41.76-102.24T696-432q60.48 0 102.24 41.76T840-288q0 60.48-41.76 102.24T696-144Zm.12-72Q726-216 747-237.12q21-21.12 21-51T746.88-339q-21.12-21-51-21T645-338.88q-21 21.12-21 51T645.12-237q21.12 21 51 21ZM168-252v-72h312v72H168Zm96-276q-60.48 0-102.24-41.76T120-672q0-60.48 41.76-102.24T264-816q60.48 0 102.24 41.76T408-672q0 60.48-41.76 102.24T264-528Zm.12-72Q294-600 315-621.12q21-21.12 21-51T314.88-723q-21.12-21-51-21T213-722.88q-21 21.12-21 51T213.12-621q21.12 21 51 21ZM480-636v-72h312v72H480Zm216 348ZM264-672Z"/></svg> button in the address bar of your browser, then "Permissions", and finally "Reset permissions". You can then reload the page to try again.</div>
284
- <button id="zappar-permission-reload-button">Reload</button>
285
+ <div class="zappar-title">${(_a = options === null || options === void 0 ? void 0 : options.title) !== null && _a !== void 0 ? _a : 'Permission is Needed'}</div>
286
+ <div class="zappar-text">${(_c = (_b = options === null || options === void 0 ? void 0 : options.descriptionChrome) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.description) !== null && _c !== void 0 ? _c : `Permission to access your device's camera and motion sensors is necessary for this experience.<br/><br/>To grant access, please tap the <svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 -960 960 960" width="16px" fill="white"><path d="M696-144q-60.48 0-102.24-41.76T552-288q0-60.48 41.76-102.24T696-432q60.48 0 102.24 41.76T840-288q0 60.48-41.76 102.24T696-144Zm.12-72Q726-216 747-237.12q21-21.12 21-51T746.88-339q-21.12-21-51-21T645-338.88q-21 21.12-21 51T645.12-237q21.12 21 51 21ZM168-252v-72h312v72H168Zm96-276q-60.48 0-102.24-41.76T120-672q0-60.48 41.76-102.24T264-816q60.48 0 102.24 41.76T408-672q0 60.48-41.76 102.24T264-528Zm.12-72Q294-600 315-621.12q21-21.12 21-51T314.88-723q-21.12-21-51-21T213-722.88q-21 21.12-21 51T213.12-621q21.12 21 51 21ZM480-636v-72h312v72H480Zm216 348ZM264-672Z"/></svg> button in the address bar of your browser, then "Permissions", and finally "Reset permissions". You can then reload the page to try again.`}</div>
287
+ <button id="zappar-permission-reload-button">${(_d = options === null || options === void 0 ? void 0 : options.button) !== null && _d !== void 0 ? _d : 'Reload'}</button>
285
288
  </div>
286
289
  `;
287
290
  document.body.append(div);
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "3.0.1-beta.0";
1
+ export declare const VERSION = "3.0.1-beta.1";
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "3.0.1-beta.0";
1
+ export const VERSION = "3.0.1-beta.1";
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappar/zappar-cv",
3
- "version": "3.0.1-beta.0",
3
+ "version": "3.0.1-beta.1",
4
4
  "description": "Zappar's core computer vision library, supporting image, face and world tracking.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",