@snap/camera-kit 0.9.0 → 0.10.0

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 (205) hide show
  1. package/README.md +18 -15
  2. package/docs/html/assets/search.js +1 -1
  3. package/docs/html/classes/CameraKit.html +5 -3
  4. package/docs/html/classes/CameraKitSession.html +5 -4
  5. package/docs/html/classes/CameraKitSource.html +5 -3
  6. package/docs/html/classes/LensPerformanceMeasurement.html +5 -3
  7. package/docs/html/classes/LensPerformanceMetrics.html +5 -3
  8. package/docs/html/classes/LensRepository.html +5 -3
  9. package/docs/html/classes/LensSources.html +5 -3
  10. package/docs/html/classes/Transform2D.html +5 -3
  11. package/docs/html/classes/TypedCustomEvent.html +5 -3
  12. package/docs/html/classes/TypedEventTarget.html +5 -3
  13. package/docs/html/functions/Injectable.html +5 -3
  14. package/docs/html/functions/bootstrapCameraKit.html +5 -3
  15. package/docs/html/functions/createExtension.html +5 -3
  16. package/docs/html/functions/createImageSource.html +5 -3
  17. package/docs/html/functions/createMediaStreamSource.html +6 -4
  18. package/docs/html/functions/createUserMediaSource.html +9 -3
  19. package/docs/html/functions/createVideoSource.html +5 -3
  20. package/docs/html/functions/estimateLensPerformance.html +5 -3
  21. package/docs/html/functions/getRequiredBootstrapURLs.html +5 -3
  22. package/docs/html/functions/lensSourcesFactory.html +5 -3
  23. package/docs/html/functions/uriHandlersFactory.html +5 -3
  24. package/docs/html/index.html +11 -9
  25. package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +5 -3
  26. package/docs/html/interfaces/CameraKitSourceSubscriber.html +5 -3
  27. package/docs/html/interfaces/ComputedFrameMetrics.html +5 -3
  28. package/docs/html/interfaces/CreateSessionOptions.html +5 -3
  29. package/docs/html/interfaces/EstimatedLensPerformance.html +5 -3
  30. package/docs/html/interfaces/Lens.html +16 -6
  31. package/docs/html/interfaces/LensSource.html +5 -3
  32. package/docs/html/interfaces/MediaStreamSourceOptions.html +5 -3
  33. package/docs/html/interfaces/Preview.html +133 -0
  34. package/docs/html/interfaces/Snapcode.html +140 -0
  35. package/docs/html/interfaces/UriCancelRequest.html +5 -3
  36. package/docs/html/interfaces/UriHandler.html +5 -3
  37. package/docs/html/interfaces/UriRequest.html +5 -3
  38. package/docs/html/interfaces/UriResponse.html +5 -3
  39. package/docs/html/interfaces/VideoSourceOptions.html +5 -3
  40. package/docs/html/modules.html +8 -4
  41. package/docs/html/types/AssetLoader.html +5 -3
  42. package/docs/html/types/AssetTiming.html +5 -3
  43. package/docs/html/types/BenchmarkError.html +5 -3
  44. package/docs/html/types/BootstrapError.html +5 -3
  45. package/docs/html/types/CacheKeyNotFoundError.html +5 -3
  46. package/docs/html/types/CameraKitDeviceInfo.html +5 -3
  47. package/docs/html/types/CameraKitSessionEventListener.html +5 -3
  48. package/docs/html/types/CameraKitSessionEvents.html +5 -3
  49. package/docs/html/types/CameraKitSourceError.html +5 -3
  50. package/docs/html/types/CameraKitSourceInfo.html +5 -3
  51. package/docs/html/types/CameraKitSourceOptions.html +5 -3
  52. package/docs/html/types/ConfigurationError.html +5 -3
  53. package/docs/html/types/Keyboard.html +5 -3
  54. package/docs/html/types/KeyboardEvents.html +5 -3
  55. package/docs/html/types/LegalError.html +5 -3
  56. package/docs/html/types/LensAssetError.html +5 -3
  57. package/docs/html/types/LensContentValidationError.html +5 -3
  58. package/docs/html/types/LensError.html +5 -3
  59. package/docs/html/types/LensExecutionError.html +5 -3
  60. package/docs/html/types/LensImagePickerError.html +5 -3
  61. package/docs/html/types/LensLaunchParams.html +5 -3
  62. package/docs/html/types/LensMetricsEvents.html +5 -3
  63. package/docs/html/types/LensPerformanceCluster.html +5 -3
  64. package/docs/html/types/LensView.html +5 -3
  65. package/docs/html/types/LensWait.html +5 -3
  66. package/docs/html/types/PersistentStoreError.html +5 -3
  67. package/docs/html/types/PlatformNotSupportedError.html +5 -3
  68. package/docs/html/types/PublicContainer.html +5 -3
  69. package/docs/html/types/RenderTarget.html +5 -3
  70. package/docs/html/types/Uri.html +5 -3
  71. package/docs/html/types/UriHandlers.html +5 -3
  72. package/docs/html/types/WebGLError.html +5 -3
  73. package/docs/html/variables/extensionRequestContext.html +5 -3
  74. package/docs/md/README.md +18 -15
  75. package/docs/md/classes/CameraKit.md +1 -1
  76. package/docs/md/classes/CameraKitSession.md +1 -2
  77. package/docs/md/classes/CameraKitSource.md +1 -1
  78. package/docs/md/classes/LensPerformanceMeasurement.md +1 -1
  79. package/docs/md/classes/LensPerformanceMetrics.md +1 -1
  80. package/docs/md/classes/LensRepository.md +1 -1
  81. package/docs/md/classes/LensSources.md +1 -1
  82. package/docs/md/classes/Transform2D.md +1 -1
  83. package/docs/md/classes/TypedCustomEvent.md +1 -1
  84. package/docs/md/classes/TypedEventTarget.md +1 -1
  85. package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +1 -1
  86. package/docs/md/interfaces/CameraKitSourceSubscriber.md +1 -1
  87. package/docs/md/interfaces/ComputedFrameMetrics.md +1 -1
  88. package/docs/md/interfaces/CreateSessionOptions.md +1 -1
  89. package/docs/md/interfaces/EstimatedLensPerformance.md +1 -1
  90. package/docs/md/interfaces/Lens.md +14 -3
  91. package/docs/md/interfaces/LensSource.md +1 -1
  92. package/docs/md/interfaces/MediaStreamSourceOptions.md +1 -1
  93. package/docs/md/interfaces/Preview.md +19 -0
  94. package/docs/md/interfaces/Snapcode.md +28 -0
  95. package/docs/md/interfaces/UriCancelRequest.md +1 -1
  96. package/docs/md/interfaces/UriHandler.md +1 -1
  97. package/docs/md/interfaces/UriRequest.md +1 -1
  98. package/docs/md/interfaces/UriResponse.md +1 -1
  99. package/docs/md/interfaces/VideoSourceOptions.md +1 -1
  100. package/docs/md/modules.md +11 -3
  101. package/lib/CameraKit.d.ts +10 -6
  102. package/lib/CameraKit.js +2 -1
  103. package/lib/CameraKit.js.map +1 -1
  104. package/lib/__tests__/data.js +9 -1
  105. package/lib/__tests__/data.js.map +1 -1
  106. package/lib/assertPlatformSupported.js +1 -1
  107. package/lib/assertPlatformSupported.js.map +1 -1
  108. package/lib/benchmark/webglUtils.js +2 -2
  109. package/lib/benchmark/webglUtils.js.map +1 -1
  110. package/lib/bootstrapCameraKit.js +4 -2
  111. package/lib/bootstrapCameraKit.js.map +1 -1
  112. package/lib/common/validate.js +2 -2
  113. package/lib/common/validate.js.map +1 -1
  114. package/lib/dependency-injection/RootServices.d.ts +2 -0
  115. package/lib/dependency-injection/RootServices.js.map +1 -1
  116. package/lib/environment.json +1 -1
  117. package/lib/events/scan.js +1 -1
  118. package/lib/events/scan.js.map +1 -1
  119. package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +17 -0
  120. package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js +63 -1
  121. package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -1
  122. package/lib/generated-proto/pb_schema/camera_kit/v3/export.d.ts +38 -1
  123. package/lib/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +64 -3
  124. package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js +70 -2
  125. package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -1
  126. package/lib/generated-proto/pb_schema/camera_kit/v3/service.d.ts +457 -3
  127. package/lib/generated-proto/pb_schema/camera_kit/v3/service.js +109 -3
  128. package/lib/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -1
  129. package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +1339 -1852
  130. package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.js +55 -132
  131. package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.js.map +1 -1
  132. package/lib/generated-proto/pb_schema/cdp/cof/config_request.d.ts +8 -1
  133. package/lib/generated-proto/pb_schema/cdp/cof/config_request.js.map +1 -1
  134. package/lib/generated-proto/pb_schema/cdp/cof/config_response.d.ts +181 -0
  135. package/lib/generated-proto/pb_schema/cdp/cof/config_result.d.ts +406 -0
  136. package/lib/generated-proto/pb_schema/cdp/cof/config_result.js +42 -0
  137. package/lib/generated-proto/pb_schema/cdp/cof/config_result.js.map +1 -1
  138. package/lib/generated-proto/pb_schema/common/ruid.d.ts +2 -0
  139. package/lib/generated-proto/pb_schema/common/ruid.js +2 -0
  140. package/lib/generated-proto/pb_schema/common/ruid.js.map +1 -1
  141. package/lib/generated-proto/pb_schema/common/value.d.ts +22 -0
  142. package/lib/generated-proto/pb_schema/common/value.js +45 -0
  143. package/lib/generated-proto/pb_schema/common/value.js.map +1 -1
  144. package/lib/generated-proto/pb_schema/lenses/launchdata.d.ts +2 -0
  145. package/lib/generated-proto/pb_schema/lenses/launchdata.js +12 -0
  146. package/lib/generated-proto/pb_schema/lenses/launchdata.js.map +1 -1
  147. package/lib/handlers/HandlerChainBuilder.d.ts +15 -0
  148. package/lib/handlers/HandlerChainBuilder.js +8 -1
  149. package/lib/handlers/HandlerChainBuilder.js.map +1 -1
  150. package/lib/handlers/requestStateEmittingHandler.d.ts +18 -5
  151. package/lib/handlers/requestStateEmittingHandler.js +12 -8
  152. package/lib/handlers/requestStateEmittingHandler.js.map +1 -1
  153. package/lib/handlers/responseCachingHandler.d.ts +10 -2
  154. package/lib/handlers/responseCachingHandler.js +13 -4
  155. package/lib/handlers/responseCachingHandler.js.map +1 -1
  156. package/lib/index.d.ts +1 -1
  157. package/lib/index.js.map +1 -1
  158. package/lib/lens/Lens.d.ts +32 -3
  159. package/lib/lens/Lens.js +10 -3
  160. package/lib/lens/Lens.js.map +1 -1
  161. package/lib/lens/LensLaunchParams.js +6 -4
  162. package/lib/lens/LensLaunchParams.js.map +1 -1
  163. package/lib/lens/LensPersistenceStore.js +1 -1
  164. package/lib/lens/LensPersistenceStore.js.map +1 -1
  165. package/lib/lens/LensRepository.d.ts +3 -2
  166. package/lib/lens/LensRepository.js +6 -5
  167. package/lib/lens/LensRepository.js.map +1 -1
  168. package/lib/lens/assets/LensAssetRepository.d.ts +5 -3
  169. package/lib/lens/assets/LensAssetRepository.js +21 -12
  170. package/lib/lens/assets/LensAssetRepository.js.map +1 -1
  171. package/lib/lens/assets/LensAssetsProvider.js +1 -1
  172. package/lib/lens/assets/LensAssetsProvider.js.map +1 -1
  173. package/lib/lens/lensEnvelopeUtil.js +1 -1
  174. package/lib/lens/lensEnvelopeUtil.js.map +1 -1
  175. package/lib/lens-client-interface/imagePicker.js +2 -2
  176. package/lib/lens-client-interface/imagePicker.js.map +1 -1
  177. package/lib/lens-client-interface/lensClientInterface.js +1 -1
  178. package/lib/lens-client-interface/lensClientInterface.js.map +1 -1
  179. package/lib/lens-core-module/loader/lensCoreFactory.js +1 -1
  180. package/lib/lens-core-module/loader/lensCoreFactory.js.map +1 -1
  181. package/lib/lensCoreWasmVersions.json +3 -3
  182. package/lib/media-sources/FunctionSource.js +1 -1
  183. package/lib/media-sources/FunctionSource.js.map +1 -1
  184. package/lib/media-sources/MediaStreamSource.d.ts +5 -1
  185. package/lib/media-sources/MediaStreamSource.js +30 -6
  186. package/lib/media-sources/MediaStreamSource.js.map +1 -1
  187. package/lib/metrics/reporters/reportHttpMetrics.d.ts +3 -3
  188. package/lib/metrics/reporters/reportHttpMetrics.js +2 -2
  189. package/lib/metrics/reporters/reportHttpMetrics.js.map +1 -1
  190. package/lib/metrics/reporters/reportLensAndAssetDownload.d.ts +3 -3
  191. package/lib/metrics/reporters/reportLensAndAssetDownload.js +6 -2
  192. package/lib/metrics/reporters/reportLensAndAssetDownload.js.map +1 -1
  193. package/lib/metrics/reporters/reporters.d.ts +3 -2
  194. package/lib/remote-configuration/cofHandler.d.ts +4 -1
  195. package/lib/remote-configuration/cofHandler.js +10 -6
  196. package/lib/remote-configuration/cofHandler.js.map +1 -1
  197. package/lib/remote-configuration/remoteConfiguration.d.ts +5 -3
  198. package/lib/remote-configuration/remoteConfiguration.js +6 -4
  199. package/lib/remote-configuration/remoteConfiguration.js.map +1 -1
  200. package/lib/session/CameraKitSession.d.ts +0 -1
  201. package/lib/session/CameraKitSession.js +4 -4
  202. package/lib/session/CameraKitSession.js.map +1 -1
  203. package/lib/session/lensState.js +2 -3
  204. package/lib/session/lensState.js.map +1 -1
  205. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"lensState.js","sourceRoot":"","sources":["../../src/session/lensState.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,YAAY,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,UAAU,EACV,UAAU,EACV,IAAI,EACJ,GAAG,EACH,KAAK,EACL,QAAQ,EACR,UAAU,EACV,EAAE,EACF,SAAS,EACT,IAAI,EACJ,SAAS,EACT,GAAG,GACN,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,OAAO,EAAkB,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAkB,MAAM,qBAAqB,CAAC;AAGtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAoB,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAc,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAuB,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrG,OAAO,EACH,UAAU,EAEV,0BAA0B,EAE1B,SAAS,GAEZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC;AAEtC,MAAM,eAAe,GAAG,GAAG,EAAE;IACzB,MAAM,OAAO,GAAG,aAAa,CACzB,YAAY,CAAC,WAAW,CAAC,EAAmD,EAC5E,YAAY,CAAC,kBAAkB,CAAC,EAAQ,EACxC,YAAY,CAAC,U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CAAC,EAAE,EAAE,CACd,SAAS,CAAC,MAAM,CAAC,IAAI;IACjB,qDAAqD;IACrD,QAAQ,CAAC,aAAa,CAAC;IACvB,6FAA6F;IAC7F,oFAAoF;IACpF,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EACzD,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CACf,CACJ,EACD,QAAQ,CAAC,SAAS,CAAC,CACtB;SACA,SAAS,EAAE,CAAC;IAEjB,kBAAkB;IAClB,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAEhG,OAAO,SAAS,CAAC;AACrB,CAAC,CACJ,CAAC","sourcesContent":["import {\n Actions,\n defineAction,\n defineActions,\n defineState,\n defineStates,\n dispatch,\n forActions,\n inStates,\n StateMachine,\n} from \"@snap/state-management\";\nimport {\n catchError,\n exhaustMap,\n from,\n map,\n merge,\n mergeMap,\n Observable,\n of,\n switchMap,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { ensureError } from \"../common/errorHelpers\";\nimport { Injectable } from \"../dependency-injection/Injectable\";\nimport { Lens } from \"../lens/Lens\";\nimport { LensRepository, lensRepositoryFactory } from \"../lens/LensRepository\";\nimport { lensCoreFactory, LensCoreModule } from \"../lens-core-module\";\nimport { AddLensInput } from \"../lens-core-module/generated-types\";\nimport { IndexedDBPersistence } from \"../persistence/IndexedDBPersistence\";\nimport { lensPersistenceStoreFactory } from \"../lens/LensPersistenceStore\";\nimport { createLaunchData, LensLaunchParams } from \"../lens/LensLaunchParams\";\nimport { LegalState, legalStateFactory } from \"../legal/legalState\";\nimport { LensAssetRepository, lensAssetRepositoryFactory } from \"../lens/assets/LensAssetRepository\";\nimport {\n legalError,\n LegalError,\n lensContentValidationError,\n LensContentValidationError,\n lensError,\n LensError,\n} from \"../namedErrors\";\nimport { getLogger } from \"../logger/logger\";\n\nconst logger = getLogger(\"LensState\");\n\nconst createLensState = () => {\n const actions = defineActions(\n defineAction(\"applyLens\")<{ lens: Lens; launchParams?: LensLaunchParams }>(),\n defineAction(\"downloadComplete\")<Lens>(),\n defineAction(\"turnedOn\")<Lens>(),\n defineAction(\"resourcesLoaded\")<Lens>(),\n defineAction(\"firstFrameProcessed\")<Lens>(),\n defineAction(\"applyLensComplete\")<Lens>(),\n defineAction(\"applyLensFailed\")<{ error: LensErrors; lens: Lens }>(),\n\n defineAction(\"removeLens\")(),\n defineAction(\"turnedOff\")<Lens>(),\n defineAction(\"removeLensComplete\")(),\n defineAction(\"removeLensFailed\")<Error>()\n );\n\n const states = defineStates(\n defineState(\"noLensApplied\")(),\n defineState(\"applyingLens\")<Lens>(),\n defineState(\"lensApplied\")<Lens>()\n );\n\n return new StateMachine(actions, states, states.noLensApplied(), (events) =>\n merge(\n events.pipe(\n // We allow a new lens to be applied at any time, no matter the state.\n inStates(\"noLensApplied\", \"applyingLens\", \"lensApplied\"),\n forActions(\"applyLens\"),\n map(([a]) => states.applyingLens(a.data.lens))\n ),\n events.pipe(\n inStates(\"applyingLens\"),\n forActions(\"applyLensComplete\"),\n map(([a]) => states.lensApplied(a.data))\n ),\n events.pipe(\n inStates(\"applyingLens\"),\n forActions(\"applyLensFailed\"),\n map(() => states.noLensApplied())\n ),\n events.pipe(\n inStates(\"lensApplied\"),\n forActions(\"removeLensComplete\"),\n map(() => states.noLensApplied())\n )\n )\n );\n};\n\nexport type LensErrors = LegalError | LensContentValidationError | LensError;\n\nexport type LensState = ReturnType<typeof createLensState>;\n\nexport const lensStateFactory = Injectable(\n \"lensState\",\n [\n lensCoreFactory.token,\n lensRepositoryFactory.token,\n lensAssetRepositoryFactory.token,\n lensPersistenceStoreFactory.token,\n legalStateFactory.token,\n ] as const,\n (\n lensCore: LensCoreModule,\n lensRepository: LensRepository,\n lensAssetRepository: LensAssetRepository,\n lensPersistence: IndexedDBPersistence<ArrayBuffer>,\n legalState: LegalState\n ): LensState => {\n const lensState = createLensState();\n\n /**\n * Apply lens\n */\n lensState.events\n .pipe(\n forActions(\"applyLens\"),\n\n // Determine the legal state (e.g. terms have been accepted). Using exhaustMap means while we are\n // ascertaining legal status (which may include prompting the end user to accept terms), we will ignore\n // any new applyLens actions.\n exhaustMap(([a]) =>\n of(legalState.actions.requestLegalPrompt()).pipe(\n dispatch(legalState),\n inStates(\"accepted\", \"rejected\"),\n take(1),\n map(([, { name }]) => {\n if (name === \"accepted\") return a;\n return lensState.actions.applyLensFailed({\n error: legalError(\n `Failed to apply lens ${a.data.lens.id}. Required legal terms were not ` +\n `accepted.`\n ),\n lens: a.data.lens,\n });\n })\n )\n ),\n\n // The use of switchMap is important so that if we get a new applyLens action while we're still\n // downloading lens content for a previously-requested lens, we can cancel those requests and ensure\n // that lenses are applied in the order they're requested.\n switchMap((a) => {\n if (a.name === \"applyLensFailed\") return of(a);\n\n const { lens } = a.data;\n\n // Convenience method making dispatching an action with Lens data less verbose.\n const dispatch = (action: Extract<Actions<LensState>, { data: Lens }>[\"name\"]) =>\n lensState.dispatch(action, lens);\n\n return of(a.data).pipe(\n mergeMap(({ lens, launchParams }) =>\n // If retrieval throws an error, we still want to proceed with the lens\n // because persisted data is not a necessity.\n from(lensPersistence.retrieve(lens.id).catch(() => undefined)).pipe(\n map((persistentStore) => ({ lens, launchParams, persistentStore }))\n )\n ),\n\n map(({ lens, launchParams, persistentStore }) => {\n const launchData = createLaunchData({\n launchParams,\n persistentStore,\n });\n\n const lensDetails = lensRepository.getLensMetadata(lens.id);\n if (!lensDetails) {\n throw new Error(\n `Cannot apply lens ${lens.id}. It has not been loaded by the Lens repository. ` +\n `Use CameraKit.lenses.repository.loadLens (or loadLensGroups) to load lens ` +\n `metadata before calling CameraKitSession.applyLens.`\n );\n }\n\n const { content } = lensDetails;\n if (!content) {\n throw new Error(\n `Cannot apply lens ${lens.id}. Metadata retrieved for this lens does not include ` +\n `the lens content URL.`\n );\n }\n\n return { lens, launchData, content };\n }),\n\n // Load lens assets and the lens itself in parallel. Both count toward lens download time.\n // TODO: use RxJS fetch utilities so that these requests can be cancelled on unsubscribe.\n mergeMap(({ lens, launchData, content }) =>\n from(\n Promise.all([\n lensRepository.getLensContent(lens),\n lensAssetRepository.cacheAssets(content.assetManifest, lens),\n ])\n ).pipe(\n tap(() => lensState.dispatch(\"downloadComplete\", lens)),\n map(([{ lensBuffer, lensChecksum }]): AddLensInput => {\n // NOTE: cached array buffer has to be copied each time in order to be reused,\n // otherwise the original cached copy would be detached by LensCore\n // One optimization can be done here: do not copy the array if getLensContent()\n // returned uncached buffer\n const lensDataBuffer = lensBuffer.slice(0);\n // LensCore chokes trying if launchData is set to undefined; we must omit it.\n return launchData === undefined\n ? { lensId: lens.id, lensDataBuffer, lensChecksum }\n : { lensId: lens.id, lensDataBuffer, lensChecksum, launchData };\n })\n )\n ),\n\n // If removeLens is dispatched while downloading, cancel download, don't apply the lens.\n takeUntil(lensState.events.pipe(forActions(\"removeLens\"))),\n\n // Once the lens has downloaded, we can call replaceLenses. We're not concerned about waiting\n // for prior in-progress calls to replaceLenses to complete, because LensCore guarantees that\n // calls to replaceLenses will always be processed sequentially in the order they are received.\n mergeMap(\n (lensInput) =>\n new Observable<Actions<LensState>>((subscriber) => {\n // replaceLenses has the property that if it fails, LensCore guarantees that no\n // lenses are active – so we can safely dispatch applyLensFailed and transition to\n // noLensApplied state.\n lensCore.replaceLenses({\n lenses: [\n {\n ...lensInput,\n onTurnOn: () => dispatch(\"turnedOn\"),\n onResourcesLoaded: () => dispatch(\"resourcesLoaded\"),\n onFirstFrameProcessed: () => dispatch(\"firstFrameProcessed\"),\n onTurnOff: () => dispatch(\"turnedOff\"),\n },\n ],\n onSuccess: () => {\n // We emit applyLensComplete (and applyLensFailed, below) on an Observable,\n // which is piped to `dispatch` – this allows `switchMap` to properly cancel\n // the dispatch of these actions if a new applyLens arrives while we're\n // waiting for onSuccess/onFailure.\n //\n // That's desirable behavior, because we don't want the applyingLens state\n // due to a *subsequent applyLens action* to be transitioned to lensApplied\n // by this action.\n subscriber.next(lensState.actions.applyLensComplete(lens));\n subscriber.complete();\n },\n onFailure: (reason) => {\n const lensCoreError = ensureError(reason);\n const message = `Failed to apply lens ${lensInput.lensId}.`;\n const error = /validation failed/.test(lensCoreError.message)\n ? lensContentValidationError(message, lensCoreError)\n : lensError(message, lensCoreError);\n\n subscriber.next(lensState.actions.applyLensFailed({ error, lens }));\n subscriber.complete();\n },\n });\n })\n ),\n\n catchError((error: LensErrors) => of(lensState.actions.applyLensFailed({ error, lens })))\n );\n }),\n dispatch(lensState)\n )\n .subscribe();\n\n /**\n * Remove lens\n */\n lensState.events\n .pipe(\n inStates(\"lensApplied\", \"noLensApplied\"),\n forActions(\"removeLens\"),\n mergeMap(\n () =>\n new Observable<Actions<LensState>>((subscriber) => {\n lensCore.clearAllLenses({\n onSuccess: () => {\n subscriber.next(lensState.actions.removeLensComplete());\n subscriber.complete();\n },\n onFailure: (lensCoreError: unknown) => {\n const error = new Error(\"Failed to remove lenses.\", { cause: lensCoreError });\n subscriber.next(lensState.actions.removeLensFailed(error));\n subscriber.complete();\n },\n });\n })\n ),\n dispatch(lensState)\n )\n .subscribe();\n\n lensState.events\n .pipe(\n inStates(\"applyingLens\"),\n forActions(\"removeLens\"),\n switchMap(([a]) =>\n lensState.events.pipe(\n // Wait to remove the lens until it has been applied.\n inStates(\"lensApplied\"),\n // But cancel the removal if a new applyLens supercedes the current lens. The goal here is to\n // make sure the latest apply/remove pre-empts any previous request to apply/remove.\n takeUntil(lensState.events.pipe(forActions(\"applyLens\"))),\n map(() => a)\n )\n ),\n dispatch(lensState)\n )\n .subscribe();\n\n // Log transitions\n lensState.events.subscribe(([a, s]) => logger.debug(`Action: \"${a.name}\", state: \"${s.name}\"`));\n\n return lensState;\n }\n);\n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IACvB,6FAA6F;IAC7F,oFAAoF;IACpF,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,EACzD,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CACf,CACJ,EACD,QAAQ,CAAC,SAAS,CAAC,CACtB;SACA,SAAS,EAAE,CAAC;IAEjB,kBAAkB;IAClB,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAEhG,OAAO,SAAS,CAAC;AACrB,CAAC,CACJ,CAAC","sourcesContent":["import {\n Actions,\n defineAction,\n defineActions,\n defineState,\n defineStates,\n dispatch,\n forActions,\n inStates,\n StateMachine,\n} from \"@snap/state-management\";\nimport {\n catchError,\n exhaustMap,\n from,\n map,\n merge,\n mergeMap,\n Observable,\n of,\n switchMap,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { ensureError } from \"../common/errorHelpers\";\nimport { Injectable } from \"../dependency-injection/Injectable\";\nimport { Lens } from \"../lens/Lens\";\nimport { LensRepository, lensRepositoryFactory } from \"../lens/LensRepository\";\nimport { lensCoreFactory, LensCoreModule } from \"../lens-core-module\";\nimport { AddLensInput } from \"../lens-core-module/generated-types\";\nimport { IndexedDBPersistence } from \"../persistence/IndexedDBPersistence\";\nimport { lensPersistenceStoreFactory } from \"../lens/LensPersistenceStore\";\nimport { createLaunchData, LensLaunchParams } from \"../lens/LensLaunchParams\";\nimport { LegalState, legalStateFactory } from \"../legal/legalState\";\nimport { LensAssetRepository, lensAssetRepositoryFactory } from \"../lens/assets/LensAssetRepository\";\nimport {\n legalError,\n LegalError,\n lensContentValidationError,\n LensContentValidationError,\n lensError,\n LensError,\n} from \"../namedErrors\";\nimport { getLogger } from \"../logger/logger\";\n\nconst logger = getLogger(\"LensState\");\n\nconst createLensState = () => {\n const actions = defineActions(\n defineAction(\"applyLens\")<{ lens: Lens; launchParams?: LensLaunchParams }>(),\n defineAction(\"downloadComplete\")<Lens>(),\n defineAction(\"turnedOn\")<Lens>(),\n defineAction(\"resourcesLoaded\")<Lens>(),\n defineAction(\"firstFrameProcessed\")<Lens>(),\n defineAction(\"applyLensComplete\")<Lens>(),\n defineAction(\"applyLensFailed\")<{ error: LensErrors; lens: Lens }>(),\n\n defineAction(\"removeLens\")(),\n defineAction(\"turnedOff\")<Lens>(),\n defineAction(\"removeLensComplete\")(),\n defineAction(\"removeLensFailed\")<Error>()\n );\n\n const states = defineStates(\n defineState(\"noLensApplied\")(),\n defineState(\"applyingLens\")<Lens>(),\n defineState(\"lensApplied\")<Lens>()\n );\n\n return new StateMachine(actions, states, states.noLensApplied(), (events) =>\n merge(\n events.pipe(\n // We allow a new lens to be applied at any time, no matter the state.\n inStates(\"noLensApplied\", \"applyingLens\", \"lensApplied\"),\n forActions(\"applyLens\"),\n map(([a]) => states.applyingLens(a.data.lens))\n ),\n events.pipe(\n inStates(\"applyingLens\"),\n forActions(\"applyLensComplete\"),\n map(([a]) => states.lensApplied(a.data))\n ),\n events.pipe(\n inStates(\"applyingLens\"),\n forActions(\"applyLensFailed\"),\n map(() => states.noLensApplied())\n ),\n events.pipe(\n inStates(\"lensApplied\"),\n forActions(\"removeLensComplete\"),\n map(() => states.noLensApplied())\n )\n )\n );\n};\n\nexport type LensErrors = LegalError | LensContentValidationError | LensError;\n\nexport type LensState = ReturnType<typeof createLensState>;\n\nexport const lensStateFactory = Injectable(\n \"lensState\",\n [\n lensCoreFactory.token,\n lensRepositoryFactory.token,\n lensAssetRepositoryFactory.token,\n lensPersistenceStoreFactory.token,\n legalStateFactory.token,\n ] as const,\n (\n lensCore: LensCoreModule,\n lensRepository: LensRepository,\n lensAssetRepository: LensAssetRepository,\n lensPersistence: IndexedDBPersistence<ArrayBuffer>,\n legalState: LegalState\n ): LensState => {\n const lensState = createLensState();\n\n /**\n * Apply lens\n */\n lensState.events\n .pipe(\n forActions(\"applyLens\"),\n\n // Determine the legal state (e.g. terms have been accepted). Using exhaustMap means while we are\n // ascertaining legal status (which may include prompting the end user to accept terms), we will ignore\n // any new applyLens actions.\n exhaustMap(([a]) =>\n of(legalState.actions.requestLegalPrompt()).pipe(\n dispatch(legalState),\n inStates(\"accepted\", \"rejected\"),\n take(1),\n map(([, { name }]) => {\n if (name === \"accepted\") return a;\n return lensState.actions.applyLensFailed({\n error: legalError(\n `Failed to apply lens ${a.data.lens.id}. Required legal terms were not accepted.`\n ),\n lens: a.data.lens,\n });\n })\n )\n ),\n\n // The use of switchMap is important so that if we get a new applyLens action while we're still\n // downloading lens content for a previously-requested lens, we can cancel those requests and ensure\n // that lenses are applied in the order they're requested.\n switchMap((a) => {\n if (a.name === \"applyLensFailed\") return of(a);\n\n const { lens } = a.data;\n\n // Convenience method making dispatching an action with Lens data less verbose.\n const dispatch = (action: Extract<Actions<LensState>, { data: Lens }>[\"name\"]) =>\n lensState.dispatch(action, lens);\n\n return of(a.data).pipe(\n mergeMap(({ lens, launchParams }) =>\n // If retrieval throws an error, we still want to proceed with the lens\n // because persisted data is not a necessity.\n from(lensPersistence.retrieve(lens.id).catch(() => undefined)).pipe(\n map((persistentStore) => ({ lens, launchParams, persistentStore }))\n )\n ),\n\n map(({ lens, launchParams, persistentStore }) => {\n const launchData = createLaunchData({\n launchParams,\n persistentStore,\n });\n\n const lensDetails = lensRepository.getLensMetadata(lens.id);\n if (!lensDetails) {\n throw new Error(\n `Cannot apply lens ${lens.id}. It has not been loaded by the Lens repository. ` +\n `Use CameraKit.lensRepository.loadLens (or loadLensGroups) to load lens ` +\n `metadata before calling CameraKitSession.applyLens.`\n );\n }\n\n const { content } = lensDetails;\n if (!content) {\n throw new Error(\n `Cannot apply lens ${lens.id}. Metadata retrieved for this lens does not include ` +\n `the lens content URL.`\n );\n }\n\n return { lens, launchData, content };\n }),\n\n // Load lens assets and the lens itself in parallel. Both count toward lens download time.\n // TODO: use RxJS fetch utilities so that these requests can be cancelled on unsubscribe.\n mergeMap(({ lens, launchData, content }) =>\n from(\n Promise.all([\n lensRepository.getLensContent(lens),\n lensAssetRepository.cacheAssets(content.assetManifest, lens),\n ])\n ).pipe(\n tap(() => lensState.dispatch(\"downloadComplete\", lens)),\n map(([{ lensBuffer, lensChecksum }]): AddLensInput => {\n // NOTE: cached array buffer has to be copied each time in order to be reused,\n // otherwise the original cached copy would be detached by LensCore\n // One optimization can be done here: do not copy the array if getLensContent()\n // returned uncached buffer\n const lensDataBuffer = lensBuffer.slice(0);\n // LensCore chokes trying if launchData is set to undefined; we must omit it.\n return launchData === undefined\n ? { lensId: lens.id, lensDataBuffer, lensChecksum }\n : { lensId: lens.id, lensDataBuffer, lensChecksum, launchData };\n })\n )\n ),\n\n // If removeLens is dispatched while downloading, cancel download, don't apply the lens.\n takeUntil(lensState.events.pipe(forActions(\"removeLens\"))),\n\n // Once the lens has downloaded, we can call replaceLenses. We're not concerned about waiting\n // for prior in-progress calls to replaceLenses to complete, because LensCore guarantees that\n // calls to replaceLenses will always be processed sequentially in the order they are received.\n mergeMap(\n (lensInput) =>\n new Observable<Actions<LensState>>((subscriber) => {\n // replaceLenses has the property that if it fails, LensCore guarantees that no\n // lenses are active – so we can safely dispatch applyLensFailed and transition to\n // noLensApplied state.\n lensCore.replaceLenses({\n lenses: [\n {\n ...lensInput,\n onTurnOn: () => dispatch(\"turnedOn\"),\n onResourcesLoaded: () => dispatch(\"resourcesLoaded\"),\n onFirstFrameProcessed: () => dispatch(\"firstFrameProcessed\"),\n onTurnOff: () => dispatch(\"turnedOff\"),\n },\n ],\n onSuccess: () => {\n // We emit applyLensComplete (and applyLensFailed, below) on an Observable,\n // which is piped to `dispatch` – this allows `switchMap` to properly cancel\n // the dispatch of these actions if a new applyLens arrives while we're\n // waiting for onSuccess/onFailure.\n //\n // That's desirable behavior, because we don't want the applyingLens state\n // due to a *subsequent applyLens action* to be transitioned to lensApplied\n // by this action.\n subscriber.next(lensState.actions.applyLensComplete(lens));\n subscriber.complete();\n },\n onFailure: (reason) => {\n const lensCoreError = ensureError(reason);\n const message = `Failed to apply lens ${lensInput.lensId}.`;\n const error = /validation failed/.test(lensCoreError.message)\n ? lensContentValidationError(message, lensCoreError)\n : lensError(message, lensCoreError);\n\n subscriber.next(lensState.actions.applyLensFailed({ error, lens }));\n subscriber.complete();\n },\n });\n })\n ),\n\n catchError((error: LensErrors) => of(lensState.actions.applyLensFailed({ error, lens })))\n );\n }),\n dispatch(lensState)\n )\n .subscribe();\n\n /**\n * Remove lens\n */\n lensState.events\n .pipe(\n inStates(\"lensApplied\", \"noLensApplied\"),\n forActions(\"removeLens\"),\n mergeMap(\n () =>\n new Observable<Actions<LensState>>((subscriber) => {\n lensCore.clearAllLenses({\n onSuccess: () => {\n subscriber.next(lensState.actions.removeLensComplete());\n subscriber.complete();\n },\n onFailure: (lensCoreError: unknown) => {\n const error = new Error(\"Failed to remove lenses.\", { cause: lensCoreError });\n subscriber.next(lensState.actions.removeLensFailed(error));\n subscriber.complete();\n },\n });\n })\n ),\n dispatch(lensState)\n )\n .subscribe();\n\n lensState.events\n .pipe(\n inStates(\"applyingLens\"),\n forActions(\"removeLens\"),\n switchMap(([a]) =>\n lensState.events.pipe(\n // Wait to remove the lens until it has been applied.\n inStates(\"lensApplied\"),\n // But cancel the removal if a new applyLens supercedes the current lens. The goal here is to\n // make sure the latest apply/remove pre-empts any previous request to apply/remove.\n takeUntil(lensState.events.pipe(forActions(\"applyLens\"))),\n map(() => a)\n )\n ),\n dispatch(lensState)\n )\n .subscribe();\n\n // Log transitions\n lensState.events.subscribe(([a, s]) => logger.debug(`Action: \"${a.name}\", state: \"${s.name}\"`));\n\n return lensState;\n }\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snap/camera-kit",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "description": "Camera Kit Web",
6
6
  "homepage": "https://ar.snap.com/camera-kit",