@23blocks/angular 1.0.2 → 1.1.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 (43) hide show
  1. package/dist/lib/assets/assets.service.js +43 -30
  2. package/dist/lib/assets/assets.service.js.map +1 -1
  3. package/dist/lib/authentication/authentication.service.js +49 -32
  4. package/dist/lib/authentication/authentication.service.js.map +1 -1
  5. package/dist/lib/campaigns/campaigns.service.js +51 -38
  6. package/dist/lib/campaigns/campaigns.service.js.map +1 -1
  7. package/dist/lib/company/company.service.js +50 -37
  8. package/dist/lib/company/company.service.js.map +1 -1
  9. package/dist/lib/content/content.service.js +52 -39
  10. package/dist/lib/content/content.service.js.map +1 -1
  11. package/dist/lib/conversations/conversations.service.js +59 -46
  12. package/dist/lib/conversations/conversations.service.js.map +1 -1
  13. package/dist/lib/crm/crm.service.js +69 -56
  14. package/dist/lib/crm/crm.service.js.map +1 -1
  15. package/dist/lib/files/files.service.js +42 -29
  16. package/dist/lib/files/files.service.js.map +1 -1
  17. package/dist/lib/forms/forms.service.js +45 -32
  18. package/dist/lib/forms/forms.service.js.map +1 -1
  19. package/dist/lib/geolocation/geolocation.service.js +78 -65
  20. package/dist/lib/geolocation/geolocation.service.js.map +1 -1
  21. package/dist/lib/index.js +4 -1
  22. package/dist/lib/index.js.map +1 -1
  23. package/dist/lib/jarvis/jarvis.service.js +54 -41
  24. package/dist/lib/jarvis/jarvis.service.js.map +1 -1
  25. package/dist/lib/onboarding/onboarding.service.js +45 -32
  26. package/dist/lib/onboarding/onboarding.service.js.map +1 -1
  27. package/dist/lib/products/products.service.js +80 -67
  28. package/dist/lib/products/products.service.js.map +1 -1
  29. package/dist/lib/rewards/rewards.service.js +47 -34
  30. package/dist/lib/rewards/rewards.service.js.map +1 -1
  31. package/dist/lib/sales/sales.service.js +47 -34
  32. package/dist/lib/sales/sales.service.js.map +1 -1
  33. package/dist/lib/search/search.service.js +31 -18
  34. package/dist/lib/search/search.service.js.map +1 -1
  35. package/dist/lib/simple-providers.js +109 -12
  36. package/dist/lib/simple-providers.js.map +1 -1
  37. package/dist/lib/tokens.js +26 -1
  38. package/dist/lib/tokens.js.map +1 -1
  39. package/dist/lib/university/university.service.js +58 -45
  40. package/dist/lib/university/university.service.js.map +1 -1
  41. package/dist/lib/wallet/wallet.service.js +39 -26
  42. package/dist/lib/wallet/wallet.service.js.map +1 -1
  43. package/package.json +1 -1
@@ -1,94 +1,102 @@
1
1
  import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
2
  import { _ as _ts_metadata } from "@swc/helpers/_/_ts_metadata";
3
3
  import { _ as _ts_param } from "@swc/helpers/_/_ts_param";
4
- import { Injectable, Inject } from '@angular/core';
4
+ import { Injectable, Inject, Optional } from '@angular/core';
5
5
  import { from } from 'rxjs';
6
6
  import { createFormsBlock } from '@23blocks/block-forms';
7
- import { TRANSPORT, FORMS_CONFIG } from '../tokens.js';
7
+ import { TRANSPORT, FORMS_TRANSPORT, FORMS_CONFIG } from '../tokens.js';
8
8
  export class FormsService {
9
+ /**
10
+ * Ensure the service is configured, throw helpful error if not
11
+ */ ensureConfigured() {
12
+ if (!this.block) {
13
+ throw new Error('[23blocks] FormsService is not configured. ' + "Add 'urls.forms' to your provideBlocks23() configuration.");
14
+ }
15
+ return this.block;
16
+ }
9
17
  // ───────────────────────────────────────────────────────────────────────────
10
18
  // Forms Service
11
19
  // ───────────────────────────────────────────────────────────────────────────
12
20
  listForms(params) {
13
- return from(this.block.forms.list(params));
21
+ return from(this.ensureConfigured().forms.list(params));
14
22
  }
15
23
  getForm(uniqueId) {
16
- return from(this.block.forms.get(uniqueId));
24
+ return from(this.ensureConfigured().forms.get(uniqueId));
17
25
  }
18
26
  createForm(data) {
19
- return from(this.block.forms.create(data));
27
+ return from(this.ensureConfigured().forms.create(data));
20
28
  }
21
29
  updateForm(uniqueId, data) {
22
- return from(this.block.forms.update(uniqueId, data));
30
+ return from(this.ensureConfigured().forms.update(uniqueId, data));
23
31
  }
24
32
  deleteForm(uniqueId) {
25
- return from(this.block.forms.delete(uniqueId));
33
+ return from(this.ensureConfigured().forms.delete(uniqueId));
26
34
  }
27
35
  // ───────────────────────────────────────────────────────────────────────────
28
36
  // Form Schemas Service
29
37
  // ───────────────────────────────────────────────────────────────────────────
30
38
  listFormSchemas(params) {
31
- return from(this.block.schemas.list(params));
39
+ return from(this.ensureConfigured().schemas.list(params));
32
40
  }
33
41
  getFormSchema(uniqueId) {
34
- return from(this.block.schemas.get(uniqueId));
42
+ return from(this.ensureConfigured().schemas.get(uniqueId));
35
43
  }
36
44
  createFormSchema(data) {
37
- return from(this.block.schemas.create(data));
45
+ return from(this.ensureConfigured().schemas.create(data));
38
46
  }
39
47
  updateFormSchema(uniqueId, data) {
40
- return from(this.block.schemas.update(uniqueId, data));
48
+ return from(this.ensureConfigured().schemas.update(uniqueId, data));
41
49
  }
42
50
  deleteFormSchema(uniqueId) {
43
- return from(this.block.schemas.delete(uniqueId));
51
+ return from(this.ensureConfigured().schemas.delete(uniqueId));
44
52
  }
45
53
  getLatestFormSchemaVersion(formUniqueId) {
46
- return from(this.block.schemas.getLatestVersion(formUniqueId));
54
+ return from(this.ensureConfigured().schemas.getLatestVersion(formUniqueId));
47
55
  }
48
56
  // ───────────────────────────────────────────────────────────────────────────
49
57
  // Form Instances Service
50
58
  // ───────────────────────────────────────────────────────────────────────────
51
59
  listFormInstances(params) {
52
- return from(this.block.instances.list(params));
60
+ return from(this.ensureConfigured().instances.list(params));
53
61
  }
54
62
  getFormInstance(uniqueId) {
55
- return from(this.block.instances.get(uniqueId));
63
+ return from(this.ensureConfigured().instances.get(uniqueId));
56
64
  }
57
65
  createFormInstance(data) {
58
- return from(this.block.instances.create(data));
66
+ return from(this.ensureConfigured().instances.create(data));
59
67
  }
60
68
  updateFormInstance(uniqueId, data) {
61
- return from(this.block.instances.update(uniqueId, data));
69
+ return from(this.ensureConfigured().instances.update(uniqueId, data));
62
70
  }
63
71
  deleteFormInstance(uniqueId) {
64
- return from(this.block.instances.delete(uniqueId));
72
+ return from(this.ensureConfigured().instances.delete(uniqueId));
65
73
  }
66
74
  submitFormInstance(data) {
67
- return from(this.block.instances.submit(data));
75
+ return from(this.ensureConfigured().instances.submit(data));
68
76
  }
69
77
  listFormInstancesByUser(userUniqueId, params) {
70
- return from(this.block.instances.listByUser(userUniqueId, params));
78
+ return from(this.ensureConfigured().instances.listByUser(userUniqueId, params));
71
79
  }
72
80
  listFormInstancesBySchema(formSchemaUniqueId, params) {
73
- return from(this.block.instances.listBySchema(formSchemaUniqueId, params));
81
+ return from(this.ensureConfigured().instances.listBySchema(formSchemaUniqueId, params));
74
82
  }
75
83
  // ───────────────────────────────────────────────────────────────────────────
76
84
  // Form Sets Service
77
85
  // ───────────────────────────────────────────────────────────────────────────
78
86
  listFormSets(params) {
79
- return from(this.block.sets.list(params));
87
+ return from(this.ensureConfigured().sets.list(params));
80
88
  }
81
89
  getFormSet(uniqueId) {
82
- return from(this.block.sets.get(uniqueId));
90
+ return from(this.ensureConfigured().sets.get(uniqueId));
83
91
  }
84
92
  createFormSet(data) {
85
- return from(this.block.sets.create(data));
93
+ return from(this.ensureConfigured().sets.create(data));
86
94
  }
87
95
  updateFormSet(uniqueId, data) {
88
- return from(this.block.sets.update(uniqueId, data));
96
+ return from(this.ensureConfigured().sets.update(uniqueId, data));
89
97
  }
90
98
  deleteFormSet(uniqueId) {
91
- return from(this.block.sets.delete(uniqueId));
99
+ return from(this.ensureConfigured().sets.delete(uniqueId));
92
100
  }
93
101
  // ───────────────────────────────────────────────────────────────────────────
94
102
  // Direct Block Access (for advanced usage)
@@ -97,21 +105,26 @@ export class FormsService {
97
105
  * Access the underlying block for advanced operations
98
106
  * Use this when you need access to services not wrapped by this Angular service
99
107
  */ get rawBlock() {
100
- return this.block;
108
+ return this.ensureConfigured();
101
109
  }
102
- constructor(transport, config){
103
- this.block = createFormsBlock(transport, config);
110
+ constructor(serviceTransport, legacyTransport, config){
111
+ const transport = serviceTransport != null ? serviceTransport : legacyTransport;
112
+ this.block = transport ? createFormsBlock(transport, config) : null;
104
113
  }
105
114
  }
106
115
  FormsService = _ts_decorate([
107
116
  Injectable({
108
117
  providedIn: 'root'
109
118
  }),
110
- _ts_param(0, Inject(TRANSPORT)),
111
- _ts_param(1, Inject(FORMS_CONFIG)),
119
+ _ts_param(0, Optional()),
120
+ _ts_param(0, Inject(FORMS_TRANSPORT)),
121
+ _ts_param(1, Optional()),
122
+ _ts_param(1, Inject(TRANSPORT)),
123
+ _ts_param(2, Inject(FORMS_CONFIG)),
112
124
  _ts_metadata("design:type", Function),
113
125
  _ts_metadata("design:paramtypes", [
114
- typeof Transport === "undefined" ? Object : Transport,
126
+ Object,
127
+ Object,
115
128
  typeof FormsBlockConfig === "undefined" ? Object : FormsBlockConfig
116
129
  ])
117
130
  ], FormsService);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/forms/forms.service.ts"],"sourcesContent":["import { Injectable, Inject } from '@angular/core';\nimport { Observable, from } from 'rxjs';\nimport type { Transport, PageResult } from '@23blocks/contracts';\nimport {\n createFormsBlock,\n type FormsBlock,\n type FormsBlockConfig,\n type Form,\n type CreateFormRequest,\n type UpdateFormRequest,\n type ListFormsParams,\n type FormSchema,\n type CreateFormSchemaRequest,\n type UpdateFormSchemaRequest,\n type ListFormSchemasParams,\n type FormInstance,\n type CreateFormInstanceRequest,\n type UpdateFormInstanceRequest,\n type SubmitFormInstanceRequest,\n type ListFormInstancesParams,\n type FormSet,\n type CreateFormSetRequest,\n type UpdateFormSetRequest,\n type ListFormSetsParams,\n} from '@23blocks/block-forms';\nimport { TRANSPORT, FORMS_CONFIG } from '../tokens.js';\n\n/**\n * Angular service wrapping the Forms block.\n * Converts Promise-based APIs to RxJS Observables.\n *\n * @example\n * ```typescript\n * @Component({...})\n * export class FormComponent {\n * constructor(private formsService: FormsService) {}\n *\n * loadForms() {\n * this.formsService.listForms().subscribe({\n * next: (result) => console.log('Forms:', result.data),\n * error: (err) => console.error('Failed:', err),\n * });\n * }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class FormsService {\n private readonly block: FormsBlock;\n\n constructor(\n @Inject(TRANSPORT) transport: Transport,\n @Inject(FORMS_CONFIG) config: FormsBlockConfig\n ) {\n this.block = createFormsBlock(transport, config);\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Forms Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listForms(params?: ListFormsParams): Observable<PageResult<Form>> {\n return from(this.block.forms.list(params));\n }\n\n getForm(uniqueId: string): Observable<Form> {\n return from(this.block.forms.get(uniqueId));\n }\n\n createForm(data: CreateFormRequest): Observable<Form> {\n return from(this.block.forms.create(data));\n }\n\n updateForm(uniqueId: string, data: UpdateFormRequest): Observable<Form> {\n return from(this.block.forms.update(uniqueId, data));\n }\n\n deleteForm(uniqueId: string): Observable<void> {\n return from(this.block.forms.delete(uniqueId));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Form Schemas Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listFormSchemas(params?: ListFormSchemasParams): Observable<PageResult<FormSchema>> {\n return from(this.block.schemas.list(params));\n }\n\n getFormSchema(uniqueId: string): Observable<FormSchema> {\n return from(this.block.schemas.get(uniqueId));\n }\n\n createFormSchema(data: CreateFormSchemaRequest): Observable<FormSchema> {\n return from(this.block.schemas.create(data));\n }\n\n updateFormSchema(uniqueId: string, data: UpdateFormSchemaRequest): Observable<FormSchema> {\n return from(this.block.schemas.update(uniqueId, data));\n }\n\n deleteFormSchema(uniqueId: string): Observable<void> {\n return from(this.block.schemas.delete(uniqueId));\n }\n\n getLatestFormSchemaVersion(formUniqueId: string): Observable<FormSchema> {\n return from(this.block.schemas.getLatestVersion(formUniqueId));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Form Instances Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listFormInstances(params?: ListFormInstancesParams): Observable<PageResult<FormInstance>> {\n return from(this.block.instances.list(params));\n }\n\n getFormInstance(uniqueId: string): Observable<FormInstance> {\n return from(this.block.instances.get(uniqueId));\n }\n\n createFormInstance(data: CreateFormInstanceRequest): Observable<FormInstance> {\n return from(this.block.instances.create(data));\n }\n\n updateFormInstance(uniqueId: string, data: UpdateFormInstanceRequest): Observable<FormInstance> {\n return from(this.block.instances.update(uniqueId, data));\n }\n\n deleteFormInstance(uniqueId: string): Observable<void> {\n return from(this.block.instances.delete(uniqueId));\n }\n\n submitFormInstance(data: SubmitFormInstanceRequest): Observable<FormInstance> {\n return from(this.block.instances.submit(data));\n }\n\n listFormInstancesByUser(userUniqueId: string, params?: ListFormInstancesParams): Observable<PageResult<FormInstance>> {\n return from(this.block.instances.listByUser(userUniqueId, params));\n }\n\n listFormInstancesBySchema(formSchemaUniqueId: string, params?: ListFormInstancesParams): Observable<PageResult<FormInstance>> {\n return from(this.block.instances.listBySchema(formSchemaUniqueId, params));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Form Sets Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listFormSets(params?: ListFormSetsParams): Observable<PageResult<FormSet>> {\n return from(this.block.sets.list(params));\n }\n\n getFormSet(uniqueId: string): Observable<FormSet> {\n return from(this.block.sets.get(uniqueId));\n }\n\n createFormSet(data: CreateFormSetRequest): Observable<FormSet> {\n return from(this.block.sets.create(data));\n }\n\n updateFormSet(uniqueId: string, data: UpdateFormSetRequest): Observable<FormSet> {\n return from(this.block.sets.update(uniqueId, data));\n }\n\n deleteFormSet(uniqueId: string): Observable<void> {\n return from(this.block.sets.delete(uniqueId));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Direct Block Access (for advanced usage)\n // ───────────────────────────────────────────────────────────────────────────\n\n /**\n * Access the underlying block for advanced operations\n * Use this when you need access to services not wrapped by this Angular service\n */\n get rawBlock(): FormsBlock {\n return this.block;\n }\n}\n"],"names":["Injectable","Inject","from","createFormsBlock","TRANSPORT","FORMS_CONFIG","FormsService","listForms","params","block","forms","list","getForm","uniqueId","get","createForm","data","create","updateForm","update","deleteForm","delete","listFormSchemas","schemas","getFormSchema","createFormSchema","updateFormSchema","deleteFormSchema","getLatestFormSchemaVersion","formUniqueId","getLatestVersion","listFormInstances","instances","getFormInstance","createFormInstance","updateFormInstance","deleteFormInstance","submitFormInstance","submit","listFormInstancesByUser","userUniqueId","listByUser","listFormInstancesBySchema","formSchemaUniqueId","listBySchema","listFormSets","sets","getFormSet","createFormSet","updateFormSet","deleteFormSet","rawBlock","constructor","transport","config","providedIn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;AAAA,SAASA,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACnD,SAAqBC,IAAI,QAAQ,OAAO;AAExC,SACEC,gBAAgB,QAoBX,wBAAwB;AAC/B,SAASC,SAAS,EAAEC,YAAY,QAAQ,eAAe;AAsBvD,OAAO,MAAMC;IAUX,8EAA8E;IAC9E,gBAAgB;IAChB,8EAA8E;IAE9EC,UAAUC,MAAwB,EAAgC;QAChE,OAAON,KAAK,IAAI,CAACO,KAAK,CAACC,KAAK,CAACC,IAAI,CAACH;IACpC;IAEAI,QAAQC,QAAgB,EAAoB;QAC1C,OAAOX,KAAK,IAAI,CAACO,KAAK,CAACC,KAAK,CAACI,GAAG,CAACD;IACnC;IAEAE,WAAWC,IAAuB,EAAoB;QACpD,OAAOd,KAAK,IAAI,CAACO,KAAK,CAACC,KAAK,CAACO,MAAM,CAACD;IACtC;IAEAE,WAAWL,QAAgB,EAAEG,IAAuB,EAAoB;QACtE,OAAOd,KAAK,IAAI,CAACO,KAAK,CAACC,KAAK,CAACS,MAAM,CAACN,UAAUG;IAChD;IAEAI,WAAWP,QAAgB,EAAoB;QAC7C,OAAOX,KAAK,IAAI,CAACO,KAAK,CAACC,KAAK,CAACW,MAAM,CAACR;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C,MAAwB,CAC9C;QACA,IAAI,CAAC7C,KAAK,GAAGN,iBAAiBkD,WAAWC;IAC3C;AA6HF;AArIahD;IADZN,WAAW;QAAEuD,YAAY;IAAO;IAK5BtD,aAAAA,OAAOG;IACPH,aAAAA,OAAOI;;;eADsB,qCAAA;eACA,4CAAA;;GALrBC"}
1
+ {"version":3,"sources":["../../../src/lib/forms/forms.service.ts"],"sourcesContent":["import { Injectable, Inject, Optional } from '@angular/core';\nimport { Observable, from } from 'rxjs';\nimport type { Transport, PageResult } from '@23blocks/contracts';\nimport {\n createFormsBlock,\n type FormsBlock,\n type FormsBlockConfig,\n type Form,\n type CreateFormRequest,\n type UpdateFormRequest,\n type ListFormsParams,\n type FormSchema,\n type CreateFormSchemaRequest,\n type UpdateFormSchemaRequest,\n type ListFormSchemasParams,\n type FormInstance,\n type CreateFormInstanceRequest,\n type UpdateFormInstanceRequest,\n type SubmitFormInstanceRequest,\n type ListFormInstancesParams,\n type FormSet,\n type CreateFormSetRequest,\n type UpdateFormSetRequest,\n type ListFormSetsParams,\n} from '@23blocks/block-forms';\nimport { TRANSPORT, FORMS_TRANSPORT, FORMS_CONFIG } from '../tokens.js';\n\n/**\n * Angular service wrapping the Forms block.\n * Converts Promise-based APIs to RxJS Observables.\n *\n * @example\n * ```typescript\n * @Component({...})\n * export class FormComponent {\n * constructor(private formsService: FormsService) {}\n *\n * loadForms() {\n * this.formsService.listForms().subscribe({\n * next: (result) => console.log('Forms:', result.data),\n * error: (err) => console.error('Failed:', err),\n * });\n * }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class FormsService {\n private readonly block: FormsBlock | null;\n\n constructor(\n @Optional() @Inject(FORMS_TRANSPORT) serviceTransport: Transport | null,\n @Optional() @Inject(TRANSPORT) legacyTransport: Transport | null,\n @Inject(FORMS_CONFIG) config: FormsBlockConfig\n ) {\n const transport = serviceTransport ?? legacyTransport;\n this.block = transport ? createFormsBlock(transport, config) : null;\n }\n\n /**\n * Ensure the service is configured, throw helpful error if not\n */\n private ensureConfigured(): FormsBlock {\n if (!this.block) {\n throw new Error(\n '[23blocks] FormsService is not configured. ' +\n \"Add 'urls.forms' to your provideBlocks23() configuration.\"\n );\n }\n return this.block;\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Forms Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listForms(params?: ListFormsParams): Observable<PageResult<Form>> {\n return from(this.ensureConfigured().forms.list(params));\n }\n\n getForm(uniqueId: string): Observable<Form> {\n return from(this.ensureConfigured().forms.get(uniqueId));\n }\n\n createForm(data: CreateFormRequest): Observable<Form> {\n return from(this.ensureConfigured().forms.create(data));\n }\n\n updateForm(uniqueId: string, data: UpdateFormRequest): Observable<Form> {\n return from(this.ensureConfigured().forms.update(uniqueId, data));\n }\n\n deleteForm(uniqueId: string): Observable<void> {\n return from(this.ensureConfigured().forms.delete(uniqueId));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Form Schemas Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listFormSchemas(params?: ListFormSchemasParams): Observable<PageResult<FormSchema>> {\n return from(this.ensureConfigured().schemas.list(params));\n }\n\n getFormSchema(uniqueId: string): Observable<FormSchema> {\n return from(this.ensureConfigured().schemas.get(uniqueId));\n }\n\n createFormSchema(data: CreateFormSchemaRequest): Observable<FormSchema> {\n return from(this.ensureConfigured().schemas.create(data));\n }\n\n updateFormSchema(uniqueId: string, data: UpdateFormSchemaRequest): Observable<FormSchema> {\n return from(this.ensureConfigured().schemas.update(uniqueId, data));\n }\n\n deleteFormSchema(uniqueId: string): Observable<void> {\n return from(this.ensureConfigured().schemas.delete(uniqueId));\n }\n\n getLatestFormSchemaVersion(formUniqueId: string): Observable<FormSchema> {\n return from(this.ensureConfigured().schemas.getLatestVersion(formUniqueId));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Form Instances Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listFormInstances(params?: ListFormInstancesParams): Observable<PageResult<FormInstance>> {\n return from(this.ensureConfigured().instances.list(params));\n }\n\n getFormInstance(uniqueId: string): Observable<FormInstance> {\n return from(this.ensureConfigured().instances.get(uniqueId));\n }\n\n createFormInstance(data: CreateFormInstanceRequest): Observable<FormInstance> {\n return from(this.ensureConfigured().instances.create(data));\n }\n\n updateFormInstance(uniqueId: string, data: UpdateFormInstanceRequest): Observable<FormInstance> {\n return from(this.ensureConfigured().instances.update(uniqueId, data));\n }\n\n deleteFormInstance(uniqueId: string): Observable<void> {\n return from(this.ensureConfigured().instances.delete(uniqueId));\n }\n\n submitFormInstance(data: SubmitFormInstanceRequest): Observable<FormInstance> {\n return from(this.ensureConfigured().instances.submit(data));\n }\n\n listFormInstancesByUser(userUniqueId: string, params?: ListFormInstancesParams): Observable<PageResult<FormInstance>> {\n return from(this.ensureConfigured().instances.listByUser(userUniqueId, params));\n }\n\n listFormInstancesBySchema(formSchemaUniqueId: string, params?: ListFormInstancesParams): Observable<PageResult<FormInstance>> {\n return from(this.ensureConfigured().instances.listBySchema(formSchemaUniqueId, params));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Form Sets Service\n // ───────────────────────────────────────────────────────────────────────────\n\n listFormSets(params?: ListFormSetsParams): Observable<PageResult<FormSet>> {\n return from(this.ensureConfigured().sets.list(params));\n }\n\n getFormSet(uniqueId: string): Observable<FormSet> {\n return from(this.ensureConfigured().sets.get(uniqueId));\n }\n\n createFormSet(data: CreateFormSetRequest): Observable<FormSet> {\n return from(this.ensureConfigured().sets.create(data));\n }\n\n updateFormSet(uniqueId: string, data: UpdateFormSetRequest): Observable<FormSet> {\n return from(this.ensureConfigured().sets.update(uniqueId, data));\n }\n\n deleteFormSet(uniqueId: string): Observable<void> {\n return from(this.ensureConfigured().sets.delete(uniqueId));\n }\n\n // ───────────────────────────────────────────────────────────────────────────\n // Direct Block Access (for advanced usage)\n // ───────────────────────────────────────────────────────────────────────────\n\n /**\n * Access the underlying block for advanced operations\n * Use this when you need access to services not wrapped by this Angular service\n */\n get rawBlock(): FormsBlock {\n return this.ensureConfigured();\n }\n}\n"],"names":["Injectable","Inject","Optional","from","createFormsBlock","TRANSPORT","FORMS_TRANSPORT","FORMS_CONFIG","FormsService","ensureConfigured","block","Error","listForms","params","forms","list","getForm","uniqueId","get","createForm","data","create","updateForm","update","deleteForm","delete","listFormSchemas","schemas","getFormSchema","createFormSchema","updateFormSchema","deleteFormSchema","getLatestFormSchemaVersion","formUniqueId","getLatestVersion","listFormInstances","instances","getFormInstance","createFormInstance","updateFormInstance","deleteFormInstance","submitFormInstance","submit","listFormInstancesByUser","userUniqueId","listByUser","listFormInstancesBySchema","formSchemaUniqueId","listBySchema","listFormSets","sets","getFormSet","createFormSet","updateFormSet","deleteFormSet","rawBlock","constructor","serviceTransport","legacyTransport","config","transport","providedIn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;AAAA,SAASA,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,gBAAgB;AAC7D,SAAqBC,IAAI,QAAQ,OAAO;AAExC,SACEC,gBAAgB,QAoBX,wBAAwB;AAC/B,SAASC,SAAS,EAAEC,eAAe,EAAEC,YAAY,QAAQ,eAAe;AAsBxE,OAAO,MAAMC;IAYX;;GAEC,GACD,AAAQC,mBAA+B;QACrC,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;YACf,MAAM,IAAIC,MACR,gDACA;QAEJ;QACA,OAAO,IAAI,CAACD,KAAK;IACnB;IAEA,8EAA8E;IAC9E,gBAAgB;IAChB,8EAA8E;IAE9EE,UAAUC,MAAwB,EAAgC;QAChE,OAAOV,KAAK,IAAI,CAACM,gBAAgB,GAAGK,KAAK,CAACC,IAAI,CAACF;IACjD;IAEAG,QAAQC,QAAgB,EAAoB;QAC1C,OAAOd,KAAK,IAAI,CAAC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K,IAAI,CAACM,gBAAgB,GAAGyC,IAAI,CAAC7B,MAAM,CAACD;IAClD;IAEAiC,cAAcpC,QAAgB,EAAEG,IAA0B,EAAuB;QAC/E,OAAOjB,KAAK,IAAI,CAACM,gBAAgB,GAAGyC,IAAI,CAAC3B,MAAM,CAACN,UAAUG;IAC5D;IAEAkC,cAAcrC,QAAgB,EAAoB;QAChD,OAAOd,KAAK,IAAI,CAACM,gBAAgB,GAAGyC,IAAI,CAACzB,MAAM,CAACR;IAClD;IAEA,8EAA8E;IAC9E,2CAA2C;IAC3C,8EAA8E;IAE9E;;;GAGC,GACD,IAAIsC,WAAuB;QACzB,OAAO,IAAI,CAAC9C,gBAAgB;IAC9B;IAhJA+C,YACE,AAAqCC,gBAAkC,EACvE,AAA+BC,eAAiC,EAChE,AAAsBC,MAAwB,CAC9C;QACA,MAAMC,YAAYH,2BAAAA,mBAAoBC;QACtC,IAAI,CAAChD,KAAK,GAAGkD,YAAYxD,iBAAiBwD,WAAWD,UAAU;IACjE;AA0IF;AApJanD;IADZR,WAAW;QAAE6D,YAAY;IAAO;IAK5B3D,aAAAA;IAAYD,aAAAA,OAAOK;IACnBJ,aAAAA;IAAYD,aAAAA,OAAOI;IACnBJ,aAAAA,OAAOM;;;;;eAAsB,4CAAA;;GANrBC"}
@@ -1,202 +1,210 @@
1
1
  import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
2
  import { _ as _ts_metadata } from "@swc/helpers/_/_ts_metadata";
3
3
  import { _ as _ts_param } from "@swc/helpers/_/_ts_param";
4
- import { Injectable, Inject } from '@angular/core';
4
+ import { Injectable, Inject, Optional } from '@angular/core';
5
5
  import { from } from 'rxjs';
6
6
  import { createGeolocationBlock } from '@23blocks/block-geolocation';
7
- import { TRANSPORT, GEOLOCATION_CONFIG } from '../tokens.js';
7
+ import { TRANSPORT, GEOLOCATION_TRANSPORT, GEOLOCATION_CONFIG } from '../tokens.js';
8
8
  export class GeolocationService {
9
+ /**
10
+ * Ensure the service is configured, throw helpful error if not
11
+ */ ensureConfigured() {
12
+ if (!this.block) {
13
+ throw new Error('[23blocks] GeolocationService is not configured. ' + "Add 'urls.geolocation' to your provideBlocks23() configuration.");
14
+ }
15
+ return this.block;
16
+ }
9
17
  // ─────────────────────────────────────────────────────────────────────────────
10
18
  // Locations Service
11
19
  // ─────────────────────────────────────────────────────────────────────────────
12
20
  listLocations(params) {
13
- return from(this.block.locations.list(params));
21
+ return from(this.ensureConfigured().locations.list(params));
14
22
  }
15
23
  getLocation(uniqueId) {
16
- return from(this.block.locations.get(uniqueId));
24
+ return from(this.ensureConfigured().locations.get(uniqueId));
17
25
  }
18
26
  createLocation(data) {
19
- return from(this.block.locations.create(data));
27
+ return from(this.ensureConfigured().locations.create(data));
20
28
  }
21
29
  updateLocation(uniqueId, data) {
22
- return from(this.block.locations.update(uniqueId, data));
30
+ return from(this.ensureConfigured().locations.update(uniqueId, data));
23
31
  }
24
32
  deleteLocation(uniqueId) {
25
- return from(this.block.locations.delete(uniqueId));
33
+ return from(this.ensureConfigured().locations.delete(uniqueId));
26
34
  }
27
35
  recoverLocation(uniqueId) {
28
- return from(this.block.locations.recover(uniqueId));
36
+ return from(this.ensureConfigured().locations.recover(uniqueId));
29
37
  }
30
38
  searchLocations(query, params) {
31
- return from(this.block.locations.search(query, params));
39
+ return from(this.ensureConfigured().locations.search(query, params));
32
40
  }
33
41
  listDeletedLocations(params) {
34
- return from(this.block.locations.listDeleted(params));
42
+ return from(this.ensureConfigured().locations.listDeleted(params));
35
43
  }
36
44
  // ─────────────────────────────────────────────────────────────────────────────
37
45
  // Addresses Service
38
46
  // ─────────────────────────────────────────────────────────────────────────────
39
47
  listAddresses(params) {
40
- return from(this.block.addresses.list(params));
48
+ return from(this.ensureConfigured().addresses.list(params));
41
49
  }
42
50
  getAddress(uniqueId) {
43
- return from(this.block.addresses.get(uniqueId));
51
+ return from(this.ensureConfigured().addresses.get(uniqueId));
44
52
  }
45
53
  createAddress(data) {
46
- return from(this.block.addresses.create(data));
54
+ return from(this.ensureConfigured().addresses.create(data));
47
55
  }
48
56
  updateAddress(uniqueId, data) {
49
- return from(this.block.addresses.update(uniqueId, data));
57
+ return from(this.ensureConfigured().addresses.update(uniqueId, data));
50
58
  }
51
59
  deleteAddress(uniqueId) {
52
- return from(this.block.addresses.delete(uniqueId));
60
+ return from(this.ensureConfigured().addresses.delete(uniqueId));
53
61
  }
54
62
  recoverAddress(uniqueId) {
55
- return from(this.block.addresses.recover(uniqueId));
63
+ return from(this.ensureConfigured().addresses.recover(uniqueId));
56
64
  }
57
65
  searchAddresses(query, params) {
58
- return from(this.block.addresses.search(query, params));
66
+ return from(this.ensureConfigured().addresses.search(query, params));
59
67
  }
60
68
  listDeletedAddresses(params) {
61
- return from(this.block.addresses.listDeleted(params));
69
+ return from(this.ensureConfigured().addresses.listDeleted(params));
62
70
  }
63
71
  setDefaultAddress(uniqueId) {
64
- return from(this.block.addresses.setDefault(uniqueId));
72
+ return from(this.ensureConfigured().addresses.setDefault(uniqueId));
65
73
  }
66
74
  // ─────────────────────────────────────────────────────────────────────────────
67
75
  // Areas Service
68
76
  // ─────────────────────────────────────────────────────────────────────────────
69
77
  listAreas(params) {
70
- return from(this.block.areas.list(params));
78
+ return from(this.ensureConfigured().areas.list(params));
71
79
  }
72
80
  getArea(uniqueId) {
73
- return from(this.block.areas.get(uniqueId));
81
+ return from(this.ensureConfigured().areas.get(uniqueId));
74
82
  }
75
83
  createArea(data) {
76
- return from(this.block.areas.create(data));
84
+ return from(this.ensureConfigured().areas.create(data));
77
85
  }
78
86
  updateArea(uniqueId, data) {
79
- return from(this.block.areas.update(uniqueId, data));
87
+ return from(this.ensureConfigured().areas.update(uniqueId, data));
80
88
  }
81
89
  deleteArea(uniqueId) {
82
- return from(this.block.areas.delete(uniqueId));
90
+ return from(this.ensureConfigured().areas.delete(uniqueId));
83
91
  }
84
92
  recoverArea(uniqueId) {
85
- return from(this.block.areas.recover(uniqueId));
93
+ return from(this.ensureConfigured().areas.recover(uniqueId));
86
94
  }
87
95
  searchAreas(query, params) {
88
- return from(this.block.areas.search(query, params));
96
+ return from(this.ensureConfigured().areas.search(query, params));
89
97
  }
90
98
  listDeletedAreas(params) {
91
- return from(this.block.areas.listDeleted(params));
99
+ return from(this.ensureConfigured().areas.listDeleted(params));
92
100
  }
93
101
  // ─────────────────────────────────────────────────────────────────────────────
94
102
  // Regions Service
95
103
  // ─────────────────────────────────────────────────────────────────────────────
96
104
  listRegions(params) {
97
- return from(this.block.regions.list(params));
105
+ return from(this.ensureConfigured().regions.list(params));
98
106
  }
99
107
  getRegion(uniqueId) {
100
- return from(this.block.regions.get(uniqueId));
108
+ return from(this.ensureConfigured().regions.get(uniqueId));
101
109
  }
102
110
  createRegion(data) {
103
- return from(this.block.regions.create(data));
111
+ return from(this.ensureConfigured().regions.create(data));
104
112
  }
105
113
  updateRegion(uniqueId, data) {
106
- return from(this.block.regions.update(uniqueId, data));
114
+ return from(this.ensureConfigured().regions.update(uniqueId, data));
107
115
  }
108
116
  deleteRegion(uniqueId) {
109
- return from(this.block.regions.delete(uniqueId));
117
+ return from(this.ensureConfigured().regions.delete(uniqueId));
110
118
  }
111
119
  recoverRegion(uniqueId) {
112
- return from(this.block.regions.recover(uniqueId));
120
+ return from(this.ensureConfigured().regions.recover(uniqueId));
113
121
  }
114
122
  searchRegions(query, params) {
115
- return from(this.block.regions.search(query, params));
123
+ return from(this.ensureConfigured().regions.search(query, params));
116
124
  }
117
125
  listDeletedRegions(params) {
118
- return from(this.block.regions.listDeleted(params));
126
+ return from(this.ensureConfigured().regions.listDeleted(params));
119
127
  }
120
128
  // ─────────────────────────────────────────────────────────────────────────────
121
129
  // Travel Routes Service
122
130
  // ─────────────────────────────────────────────────────────────────────────────
123
131
  listRoutes(params) {
124
- return from(this.block.routes.list(params));
132
+ return from(this.ensureConfigured().routes.list(params));
125
133
  }
126
134
  getRoute(uniqueId) {
127
- return from(this.block.routes.get(uniqueId));
135
+ return from(this.ensureConfigured().routes.get(uniqueId));
128
136
  }
129
137
  createRoute(data) {
130
- return from(this.block.routes.create(data));
138
+ return from(this.ensureConfigured().routes.create(data));
131
139
  }
132
140
  updateRoute(uniqueId, data) {
133
- return from(this.block.routes.update(uniqueId, data));
141
+ return from(this.ensureConfigured().routes.update(uniqueId, data));
134
142
  }
135
143
  deleteRoute(uniqueId) {
136
- return from(this.block.routes.delete(uniqueId));
144
+ return from(this.ensureConfigured().routes.delete(uniqueId));
137
145
  }
138
146
  recoverRoute(uniqueId) {
139
- return from(this.block.routes.recover(uniqueId));
147
+ return from(this.ensureConfigured().routes.recover(uniqueId));
140
148
  }
141
149
  searchRoutes(query, params) {
142
- return from(this.block.routes.search(query, params));
150
+ return from(this.ensureConfigured().routes.search(query, params));
143
151
  }
144
152
  listDeletedRoutes(params) {
145
- return from(this.block.routes.listDeleted(params));
153
+ return from(this.ensureConfigured().routes.listDeleted(params));
146
154
  }
147
155
  // ─────────────────────────────────────────────────────────────────────────────
148
156
  // Premise Bookings Service
149
157
  // ─────────────────────────────────────────────────────────────────────────────
150
158
  listBookings(params) {
151
- return from(this.block.bookings.list(params));
159
+ return from(this.ensureConfigured().bookings.list(params));
152
160
  }
153
161
  getBooking(uniqueId) {
154
- return from(this.block.bookings.get(uniqueId));
162
+ return from(this.ensureConfigured().bookings.get(uniqueId));
155
163
  }
156
164
  createBooking(data) {
157
- return from(this.block.bookings.create(data));
165
+ return from(this.ensureConfigured().bookings.create(data));
158
166
  }
159
167
  updateBooking(uniqueId, data) {
160
- return from(this.block.bookings.update(uniqueId, data));
168
+ return from(this.ensureConfigured().bookings.update(uniqueId, data));
161
169
  }
162
170
  deleteBooking(uniqueId) {
163
- return from(this.block.bookings.delete(uniqueId));
171
+ return from(this.ensureConfigured().bookings.delete(uniqueId));
164
172
  }
165
173
  recoverBooking(uniqueId) {
166
- return from(this.block.bookings.recover(uniqueId));
174
+ return from(this.ensureConfigured().bookings.recover(uniqueId));
167
175
  }
168
176
  searchBookings(query, params) {
169
- return from(this.block.bookings.search(query, params));
177
+ return from(this.ensureConfigured().bookings.search(query, params));
170
178
  }
171
179
  listDeletedBookings(params) {
172
- return from(this.block.bookings.listDeleted(params));
180
+ return from(this.ensureConfigured().bookings.listDeleted(params));
173
181
  }
174
182
  // ─────────────────────────────────────────────────────────────────────────────
175
183
  // Premises Service
176
184
  // ─────────────────────────────────────────────────────────────────────────────
177
185
  listPremises(params) {
178
- return from(this.block.premises.list(params));
186
+ return from(this.ensureConfigured().premises.list(params));
179
187
  }
180
188
  getPremise(uniqueId) {
181
- return from(this.block.premises.get(uniqueId));
189
+ return from(this.ensureConfigured().premises.get(uniqueId));
182
190
  }
183
191
  createPremise(data) {
184
- return from(this.block.premises.create(data));
192
+ return from(this.ensureConfigured().premises.create(data));
185
193
  }
186
194
  updatePremise(uniqueId, data) {
187
- return from(this.block.premises.update(uniqueId, data));
195
+ return from(this.ensureConfigured().premises.update(uniqueId, data));
188
196
  }
189
197
  deletePremise(uniqueId) {
190
- return from(this.block.premises.delete(uniqueId));
198
+ return from(this.ensureConfigured().premises.delete(uniqueId));
191
199
  }
192
200
  recoverPremise(uniqueId) {
193
- return from(this.block.premises.recover(uniqueId));
201
+ return from(this.ensureConfigured().premises.recover(uniqueId));
194
202
  }
195
203
  searchPremises(query, params) {
196
- return from(this.block.premises.search(query, params));
204
+ return from(this.ensureConfigured().premises.search(query, params));
197
205
  }
198
206
  listDeletedPremises(params) {
199
- return from(this.block.premises.listDeleted(params));
207
+ return from(this.ensureConfigured().premises.listDeleted(params));
200
208
  }
201
209
  // ─────────────────────────────────────────────────────────────────────────────
202
210
  // Direct Block Access (for advanced usage)
@@ -205,21 +213,26 @@ export class GeolocationService {
205
213
  * Access the underlying block for advanced operations
206
214
  * Use this when you need access to services not wrapped by this Angular service
207
215
  */ get rawBlock() {
208
- return this.block;
216
+ return this.ensureConfigured();
209
217
  }
210
- constructor(transport, config){
211
- this.block = createGeolocationBlock(transport, config);
218
+ constructor(serviceTransport, legacyTransport, config){
219
+ const transport = serviceTransport != null ? serviceTransport : legacyTransport;
220
+ this.block = transport ? createGeolocationBlock(transport, config) : null;
212
221
  }
213
222
  }
214
223
  GeolocationService = _ts_decorate([
215
224
  Injectable({
216
225
  providedIn: 'root'
217
226
  }),
218
- _ts_param(0, Inject(TRANSPORT)),
219
- _ts_param(1, Inject(GEOLOCATION_CONFIG)),
227
+ _ts_param(0, Optional()),
228
+ _ts_param(0, Inject(GEOLOCATION_TRANSPORT)),
229
+ _ts_param(1, Optional()),
230
+ _ts_param(1, Inject(TRANSPORT)),
231
+ _ts_param(2, Inject(GEOLOCATION_CONFIG)),
220
232
  _ts_metadata("design:type", Function),
221
233
  _ts_metadata("design:paramtypes", [
222
- typeof Transport === "undefined" ? Object : Transport,
234
+ Object,
235
+ Object,
223
236
  typeof GeolocationBlockConfig === "undefined" ? Object : GeolocationBlockConfig
224
237
  ])
225
238
  ], GeolocationService);