@23blocks/angular 1.1.2 → 2.0.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +4230 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/assets/assets.service.d.ts +58 -0
- package/dist/src/lib/assets/assets.service.d.ts.map +1 -0
- package/dist/{lib/assets/index.js → src/lib/assets/index.d.ts} +1 -2
- package/dist/src/lib/assets/index.d.ts.map +1 -0
- package/dist/src/lib/authentication/authentication.service.d.ts +105 -0
- package/dist/src/lib/authentication/authentication.service.d.ts.map +1 -0
- package/dist/{lib/authentication/index.js → src/lib/authentication/index.d.ts} +1 -2
- package/dist/src/lib/authentication/index.d.ts.map +1 -0
- package/dist/src/lib/campaigns/campaigns.service.d.ts +66 -0
- package/dist/src/lib/campaigns/campaigns.service.d.ts.map +1 -0
- package/dist/{lib/campaigns/index.js → src/lib/campaigns/index.d.ts} +1 -2
- package/dist/src/lib/campaigns/index.d.ts.map +1 -0
- package/dist/src/lib/company/company.service.d.ts +65 -0
- package/dist/src/lib/company/company.service.d.ts.map +1 -0
- package/dist/{lib/company/index.js → src/lib/company/index.d.ts} +1 -2
- package/dist/src/lib/company/index.d.ts.map +1 -0
- package/dist/src/lib/content/content.service.d.ts +67 -0
- package/dist/src/lib/content/content.service.d.ts.map +1 -0
- package/dist/{lib/content/index.js → src/lib/content/index.d.ts} +1 -2
- package/dist/src/lib/content/index.d.ts.map +1 -0
- package/dist/src/lib/conversations/conversations.service.d.ts +74 -0
- package/dist/src/lib/conversations/conversations.service.d.ts.map +1 -0
- package/dist/{lib/conversations/index.js → src/lib/conversations/index.d.ts} +1 -2
- package/dist/src/lib/conversations/index.d.ts.map +1 -0
- package/dist/src/lib/crm/crm.service.d.ts +84 -0
- package/dist/src/lib/crm/crm.service.d.ts.map +1 -0
- package/dist/{lib/crm/index.js → src/lib/crm/index.d.ts} +1 -2
- package/dist/src/lib/crm/index.d.ts.map +1 -0
- package/dist/src/lib/files/files.service.d.ts +62 -0
- package/dist/src/lib/files/files.service.d.ts.map +1 -0
- package/dist/{lib/files/index.js → src/lib/files/index.d.ts} +1 -2
- package/dist/src/lib/files/index.d.ts.map +1 -0
- package/dist/src/lib/forms/forms.service.d.ts +60 -0
- package/dist/src/lib/forms/forms.service.d.ts.map +1 -0
- package/dist/src/lib/forms/index.d.ts +2 -0
- package/dist/src/lib/forms/index.d.ts.map +1 -0
- package/dist/src/lib/geolocation/geolocation.service.d.ts +93 -0
- package/dist/src/lib/geolocation/geolocation.service.d.ts.map +1 -0
- package/dist/{lib/geolocation/index.js → src/lib/geolocation/index.d.ts} +1 -2
- package/dist/src/lib/geolocation/index.d.ts.map +1 -0
- package/dist/src/lib/index.d.ts +22 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/{lib/jarvis/index.js → src/lib/jarvis/index.d.ts} +1 -2
- package/dist/src/lib/jarvis/index.d.ts.map +1 -0
- package/dist/src/lib/jarvis/jarvis.service.d.ts +69 -0
- package/dist/src/lib/jarvis/jarvis.service.d.ts.map +1 -0
- package/dist/{lib/onboarding/index.js → src/lib/onboarding/index.d.ts} +1 -2
- package/dist/src/lib/onboarding/index.d.ts.map +1 -0
- package/dist/src/lib/onboarding/onboarding.service.d.ts +68 -0
- package/dist/src/lib/onboarding/onboarding.service.d.ts.map +1 -0
- package/dist/{lib/products/index.js → src/lib/products/index.d.ts} +1 -2
- package/dist/src/lib/products/index.d.ts.map +1 -0
- package/dist/src/lib/products/products.service.d.ts +101 -0
- package/dist/src/lib/products/products.service.d.ts.map +1 -0
- package/dist/src/lib/providers.d.ts +97 -0
- package/dist/src/lib/providers.d.ts.map +1 -0
- package/dist/{lib/rewards/index.js → src/lib/rewards/index.d.ts} +1 -2
- package/dist/src/lib/rewards/index.d.ts.map +1 -0
- package/dist/src/lib/rewards/rewards.service.d.ts +62 -0
- package/dist/src/lib/rewards/rewards.service.d.ts.map +1 -0
- package/dist/{lib/sales/index.js → src/lib/sales/index.d.ts} +1 -2
- package/dist/src/lib/sales/index.d.ts.map +1 -0
- package/dist/src/lib/sales/sales.service.d.ts +62 -0
- package/dist/src/lib/sales/sales.service.d.ts.map +1 -0
- package/dist/{lib/search/index.js → src/lib/search/index.d.ts} +1 -2
- package/dist/src/lib/search/index.d.ts.map +1 -0
- package/dist/src/lib/search/search.service.d.ts +80 -0
- package/dist/src/lib/search/search.service.d.ts.map +1 -0
- package/dist/src/lib/simple-providers.d.ts +202 -0
- package/dist/src/lib/simple-providers.d.ts.map +1 -0
- package/dist/src/lib/tokens.d.ts +114 -0
- package/dist/src/lib/tokens.d.ts.map +1 -0
- package/dist/{lib/university/index.js → src/lib/university/index.d.ts} +1 -2
- package/dist/src/lib/university/index.d.ts.map +1 -0
- package/dist/src/lib/university/university.service.d.ts +75 -0
- package/dist/src/lib/university/university.service.d.ts.map +1 -0
- package/dist/{lib/wallet/index.js → src/lib/wallet/index.d.ts} +1 -2
- package/dist/src/lib/wallet/index.d.ts.map +1 -0
- package/dist/src/lib/wallet/wallet.service.d.ts +60 -0
- package/dist/src/lib/wallet/wallet.service.d.ts.map +1 -0
- package/package.json +10 -8
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/lib/assets/assets.service.js +0 -123
- package/dist/lib/assets/assets.service.js.map +0 -1
- package/dist/lib/assets/index.js.map +0 -1
- package/dist/lib/authentication/authentication.service.js +0 -209
- package/dist/lib/authentication/authentication.service.js.map +0 -1
- package/dist/lib/authentication/index.js.map +0 -1
- package/dist/lib/campaigns/campaigns.service.js +0 -150
- package/dist/lib/campaigns/campaigns.service.js.map +0 -1
- package/dist/lib/campaigns/index.js.map +0 -1
- package/dist/lib/company/company.service.js +0 -150
- package/dist/lib/company/company.service.js.map +0 -1
- package/dist/lib/company/index.js.map +0 -1
- package/dist/lib/content/content.service.js +0 -153
- package/dist/lib/content/content.service.js.map +0 -1
- package/dist/lib/content/index.js.map +0 -1
- package/dist/lib/conversations/conversations.service.js +0 -177
- package/dist/lib/conversations/conversations.service.js.map +0 -1
- package/dist/lib/conversations/index.js.map +0 -1
- package/dist/lib/crm/crm.service.js +0 -210
- package/dist/lib/crm/crm.service.js.map +0 -1
- package/dist/lib/crm/index.js.map +0 -1
- package/dist/lib/files/files.service.js +0 -120
- package/dist/lib/files/files.service.js.map +0 -1
- package/dist/lib/files/index.js.map +0 -1
- package/dist/lib/forms/forms.service.js +0 -132
- package/dist/lib/forms/forms.service.js.map +0 -1
- package/dist/lib/forms/index.js +0 -3
- package/dist/lib/forms/index.js.map +0 -1
- package/dist/lib/geolocation/geolocation.service.js +0 -240
- package/dist/lib/geolocation/geolocation.service.js.map +0 -1
- package/dist/lib/geolocation/index.js.map +0 -1
- package/dist/lib/index.js +0 -36
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/jarvis/index.js.map +0 -1
- package/dist/lib/jarvis/jarvis.service.js +0 -162
- package/dist/lib/jarvis/jarvis.service.js.map +0 -1
- package/dist/lib/onboarding/index.js.map +0 -1
- package/dist/lib/onboarding/onboarding.service.js +0 -132
- package/dist/lib/onboarding/onboarding.service.js.map +0 -1
- package/dist/lib/products/index.js.map +0 -1
- package/dist/lib/products/products.service.js +0 -255
- package/dist/lib/products/products.service.js.map +0 -1
- package/dist/lib/providers.js +0 -286
- package/dist/lib/providers.js.map +0 -1
- package/dist/lib/rewards/index.js.map +0 -1
- package/dist/lib/rewards/rewards.service.js +0 -138
- package/dist/lib/rewards/rewards.service.js.map +0 -1
- package/dist/lib/sales/index.js.map +0 -1
- package/dist/lib/sales/sales.service.js +0 -138
- package/dist/lib/sales/sales.service.js.map +0 -1
- package/dist/lib/search/index.js.map +0 -1
- package/dist/lib/search/search.service.js +0 -106
- package/dist/lib/search/search.service.js.map +0 -1
- package/dist/lib/simple-providers.js +0 -498
- package/dist/lib/simple-providers.js.map +0 -1
- package/dist/lib/tokens.js +0 -85
- package/dist/lib/tokens.js.map +0 -1
- package/dist/lib/university/index.js.map +0 -1
- package/dist/lib/university/university.service.js +0 -174
- package/dist/lib/university/university.service.js.map +0 -1
- package/dist/lib/wallet/index.js.map +0 -1
- package/dist/lib/wallet/wallet.service.js +0 -111
- package/dist/lib/wallet/wallet.service.js.map +0 -1
|
@@ -0,0 +1,4230 @@
|
|
|
1
|
+
import { _ } from '@swc/helpers/_/_extends';
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, Injectable } from '@angular/core';
|
|
3
|
+
import { createHttpTransport } from '@23blocks/transport-http';
|
|
4
|
+
import { from, tap } from 'rxjs';
|
|
5
|
+
import { createAuthenticationBlock } from '@23blocks/block-authentication';
|
|
6
|
+
import { createSearchBlock } from '@23blocks/block-search';
|
|
7
|
+
import { createProductsBlock } from '@23blocks/block-products';
|
|
8
|
+
import { createCrmBlock } from '@23blocks/block-crm';
|
|
9
|
+
import { createContentBlock } from '@23blocks/block-content';
|
|
10
|
+
import { createGeolocationBlock } from '@23blocks/block-geolocation';
|
|
11
|
+
import { createConversationsBlock } from '@23blocks/block-conversations';
|
|
12
|
+
import { createFilesBlock } from '@23blocks/block-files';
|
|
13
|
+
import { createFormsBlock } from '@23blocks/block-forms';
|
|
14
|
+
import { createAssetsBlock } from '@23blocks/block-assets';
|
|
15
|
+
import { createCampaignsBlock } from '@23blocks/block-campaigns';
|
|
16
|
+
import { createCompanyBlock } from '@23blocks/block-company';
|
|
17
|
+
import { createRewardsBlock } from '@23blocks/block-rewards';
|
|
18
|
+
import { createSalesBlock } from '@23blocks/block-sales';
|
|
19
|
+
import { createWalletBlock } from '@23blocks/block-wallet';
|
|
20
|
+
import { createJarvisBlock } from '@23blocks/block-jarvis';
|
|
21
|
+
import { createOnboardingBlock } from '@23blocks/block-onboarding';
|
|
22
|
+
import { createUniversityBlock } from '@23blocks/block-university';
|
|
23
|
+
|
|
24
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
25
|
+
// Transport Tokens (per-service)
|
|
26
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use per-service transport tokens (AUTHENTICATION_TRANSPORT, etc.)
|
|
29
|
+
* Shared transport token - only for backward compatibility with advanced API
|
|
30
|
+
*/ const TRANSPORT = new InjectionToken('23blocks.transport');
|
|
31
|
+
/** Transport for Authentication service */ const AUTHENTICATION_TRANSPORT = new InjectionToken('23blocks.authentication.transport');
|
|
32
|
+
/** Transport for Search service */ const SEARCH_TRANSPORT = new InjectionToken('23blocks.search.transport');
|
|
33
|
+
/** Transport for Products service */ const PRODUCTS_TRANSPORT = new InjectionToken('23blocks.products.transport');
|
|
34
|
+
/** Transport for CRM service */ const CRM_TRANSPORT = new InjectionToken('23blocks.crm.transport');
|
|
35
|
+
/** Transport for Content service */ const CONTENT_TRANSPORT = new InjectionToken('23blocks.content.transport');
|
|
36
|
+
/** Transport for Geolocation service */ const GEOLOCATION_TRANSPORT = new InjectionToken('23blocks.geolocation.transport');
|
|
37
|
+
/** Transport for Conversations service */ const CONVERSATIONS_TRANSPORT = new InjectionToken('23blocks.conversations.transport');
|
|
38
|
+
/** Transport for Files service */ const FILES_TRANSPORT = new InjectionToken('23blocks.files.transport');
|
|
39
|
+
/** Transport for Forms service */ const FORMS_TRANSPORT = new InjectionToken('23blocks.forms.transport');
|
|
40
|
+
/** Transport for Assets service */ const ASSETS_TRANSPORT = new InjectionToken('23blocks.assets.transport');
|
|
41
|
+
/** Transport for Campaigns service */ const CAMPAIGNS_TRANSPORT = new InjectionToken('23blocks.campaigns.transport');
|
|
42
|
+
/** Transport for Company service */ const COMPANY_TRANSPORT = new InjectionToken('23blocks.company.transport');
|
|
43
|
+
/** Transport for Rewards service */ const REWARDS_TRANSPORT = new InjectionToken('23blocks.rewards.transport');
|
|
44
|
+
/** Transport for Sales service */ const SALES_TRANSPORT = new InjectionToken('23blocks.sales.transport');
|
|
45
|
+
/** Transport for Wallet service */ const WALLET_TRANSPORT = new InjectionToken('23blocks.wallet.transport');
|
|
46
|
+
/** Transport for Jarvis service */ const JARVIS_TRANSPORT = new InjectionToken('23blocks.jarvis.transport');
|
|
47
|
+
/** Transport for Onboarding service */ const ONBOARDING_TRANSPORT = new InjectionToken('23blocks.onboarding.transport');
|
|
48
|
+
/** Transport for University service */ const UNIVERSITY_TRANSPORT = new InjectionToken('23blocks.university.transport');
|
|
49
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
50
|
+
// Config Tokens (per-service)
|
|
51
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
52
|
+
/**
|
|
53
|
+
* Injection token for Authentication block configuration
|
|
54
|
+
*/ const AUTHENTICATION_CONFIG = new InjectionToken('23blocks.authentication.config');
|
|
55
|
+
/**
|
|
56
|
+
* Injection token for Search block configuration
|
|
57
|
+
*/ const SEARCH_CONFIG = new InjectionToken('23blocks.search.config');
|
|
58
|
+
/**
|
|
59
|
+
* Injection token for Geolocation block configuration
|
|
60
|
+
*/ const GEOLOCATION_CONFIG = new InjectionToken('23blocks.geolocation.config');
|
|
61
|
+
/**
|
|
62
|
+
* Injection token for Content block configuration
|
|
63
|
+
*/ const CONTENT_CONFIG = new InjectionToken('23blocks.content.config');
|
|
64
|
+
/**
|
|
65
|
+
* Injection token for CRM block configuration
|
|
66
|
+
*/ const CRM_CONFIG = new InjectionToken('23blocks.crm.config');
|
|
67
|
+
/**
|
|
68
|
+
* Injection token for Products block configuration
|
|
69
|
+
*/ const PRODUCTS_CONFIG = new InjectionToken('23blocks.products.config');
|
|
70
|
+
/**
|
|
71
|
+
* Injection token for Conversations block configuration
|
|
72
|
+
*/ const CONVERSATIONS_CONFIG = new InjectionToken('23blocks.conversations.config');
|
|
73
|
+
/**
|
|
74
|
+
* Injection token for Files block configuration
|
|
75
|
+
*/ const FILES_CONFIG = new InjectionToken('23blocks.files.config');
|
|
76
|
+
/**
|
|
77
|
+
* Injection token for Assets block configuration
|
|
78
|
+
*/ const ASSETS_CONFIG = new InjectionToken('23blocks.assets.config');
|
|
79
|
+
/**
|
|
80
|
+
* Injection token for Forms block configuration
|
|
81
|
+
*/ const FORMS_CONFIG = new InjectionToken('23blocks.forms.config');
|
|
82
|
+
/**
|
|
83
|
+
* Injection token for Sales block configuration
|
|
84
|
+
*/ const SALES_CONFIG = new InjectionToken('23blocks.sales.config');
|
|
85
|
+
/**
|
|
86
|
+
* Injection token for Campaigns block configuration
|
|
87
|
+
*/ const CAMPAIGNS_CONFIG = new InjectionToken('23blocks.campaigns.config');
|
|
88
|
+
/**
|
|
89
|
+
* Injection token for Company block configuration
|
|
90
|
+
*/ const COMPANY_CONFIG = new InjectionToken('23blocks.company.config');
|
|
91
|
+
/**
|
|
92
|
+
* Injection token for Rewards block configuration
|
|
93
|
+
*/ const REWARDS_CONFIG = new InjectionToken('23blocks.rewards.config');
|
|
94
|
+
/**
|
|
95
|
+
* Injection token for Jarvis block configuration
|
|
96
|
+
*/ const JARVIS_CONFIG = new InjectionToken('23blocks.jarvis.config');
|
|
97
|
+
/**
|
|
98
|
+
* Injection token for Onboarding block configuration
|
|
99
|
+
*/ const ONBOARDING_CONFIG = new InjectionToken('23blocks.onboarding.config');
|
|
100
|
+
/**
|
|
101
|
+
* Injection token for University block configuration
|
|
102
|
+
*/ const UNIVERSITY_CONFIG = new InjectionToken('23blocks.university.config');
|
|
103
|
+
/**
|
|
104
|
+
* Injection token for Wallet block configuration
|
|
105
|
+
*/ const WALLET_CONFIG = new InjectionToken('23blocks.wallet.config');
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Injection token for the token manager (internal use)
|
|
109
|
+
*/ const TOKEN_MANAGER = new InjectionToken('23blocks.token-manager');
|
|
110
|
+
/**
|
|
111
|
+
* Injection token for provider config
|
|
112
|
+
*/ const PROVIDER_CONFIG = new InjectionToken('23blocks.provider-config');
|
|
113
|
+
/** @deprecated Use PROVIDER_CONFIG instead */ const SIMPLE_CONFIG = PROVIDER_CONFIG;
|
|
114
|
+
/**
|
|
115
|
+
* Generate storage key scoped to app and tenant
|
|
116
|
+
*/ function getStorageKey(type, appId, tenantId) {
|
|
117
|
+
const scope = tenantId ? `${appId}_${tenantId}` : appId;
|
|
118
|
+
return `23blocks_${scope}_${type}_token`;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* In-memory storage for SSR
|
|
122
|
+
*/ let MemoryStorage = class MemoryStorage {
|
|
123
|
+
getItem(key) {
|
|
124
|
+
var _this_data_get;
|
|
125
|
+
return (_this_data_get = this.data.get(key)) != null ? _this_data_get : null;
|
|
126
|
+
}
|
|
127
|
+
setItem(key, value) {
|
|
128
|
+
this.data.set(key, value);
|
|
129
|
+
}
|
|
130
|
+
removeItem(key) {
|
|
131
|
+
this.data.delete(key);
|
|
132
|
+
}
|
|
133
|
+
constructor(){
|
|
134
|
+
this.data = new Map();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Create a token manager with scoped storage keys and cross-tab sync
|
|
139
|
+
*/ function createTokenManager(appId, storageType, tenantId) {
|
|
140
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.localStorage !== 'undefined';
|
|
141
|
+
const accessTokenKey = getStorageKey('access', appId, tenantId);
|
|
142
|
+
const refreshTokenKey = getStorageKey('refresh', appId, tenantId);
|
|
143
|
+
let storage;
|
|
144
|
+
if (!isBrowser) {
|
|
145
|
+
storage = new MemoryStorage();
|
|
146
|
+
} else {
|
|
147
|
+
switch(storageType){
|
|
148
|
+
case 'sessionStorage':
|
|
149
|
+
storage = window.sessionStorage;
|
|
150
|
+
break;
|
|
151
|
+
case 'memory':
|
|
152
|
+
storage = new MemoryStorage();
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
storage = window.localStorage;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
getAccessToken () {
|
|
160
|
+
try {
|
|
161
|
+
return storage.getItem(accessTokenKey);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
getRefreshToken () {
|
|
167
|
+
try {
|
|
168
|
+
return storage.getItem(refreshTokenKey);
|
|
169
|
+
} catch (e) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
setTokens (accessToken, refreshToken) {
|
|
174
|
+
try {
|
|
175
|
+
storage.setItem(accessTokenKey, accessToken);
|
|
176
|
+
if (refreshToken) {
|
|
177
|
+
storage.setItem(refreshTokenKey, refreshToken);
|
|
178
|
+
}
|
|
179
|
+
} catch (e) {
|
|
180
|
+
console.warn('[23blocks] Unable to store tokens');
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
clearTokens () {
|
|
184
|
+
try {
|
|
185
|
+
storage.removeItem(accessTokenKey);
|
|
186
|
+
storage.removeItem(refreshTokenKey);
|
|
187
|
+
} catch (e) {
|
|
188
|
+
// Silently fail
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
onStorageChange (callback) {
|
|
192
|
+
// Only works in browser with localStorage/sessionStorage
|
|
193
|
+
if (!isBrowser || storageType === 'memory') {
|
|
194
|
+
// Return no-op unsubscribe for SSR/memory storage
|
|
195
|
+
return ()=>{};
|
|
196
|
+
}
|
|
197
|
+
const handler = (event)=>{
|
|
198
|
+
// Only trigger if our keys changed
|
|
199
|
+
if (event.key === accessTokenKey || event.key === refreshTokenKey) {
|
|
200
|
+
callback();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
window.addEventListener('storage', handler);
|
|
204
|
+
// Return unsubscribe function
|
|
205
|
+
return ()=>{
|
|
206
|
+
window.removeEventListener('storage', handler);
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Create transport with automatic token handling for a specific URL
|
|
213
|
+
*/ function createTransportWithAuth(baseUrl, config, tokenManager) {
|
|
214
|
+
return createHttpTransport({
|
|
215
|
+
baseUrl,
|
|
216
|
+
timeout: config.timeout,
|
|
217
|
+
credentials: config.authMode === 'cookie' ? 'include' : undefined,
|
|
218
|
+
headers: ()=>{
|
|
219
|
+
const headers = _({}, config.headers, {
|
|
220
|
+
'x-api-key': config.appId
|
|
221
|
+
});
|
|
222
|
+
if (config.tenantId) {
|
|
223
|
+
headers['tenant-id'] = config.tenantId;
|
|
224
|
+
}
|
|
225
|
+
// In token mode, add Authorization header if we have a token
|
|
226
|
+
if (config.authMode !== 'cookie') {
|
|
227
|
+
const token = tokenManager.getAccessToken();
|
|
228
|
+
if (token) {
|
|
229
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return headers;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Provide 23blocks services with simplified configuration.
|
|
238
|
+
*
|
|
239
|
+
* This is the recommended way to set up 23blocks in new Angular applications.
|
|
240
|
+
* It automatically handles token storage and authentication headers.
|
|
241
|
+
*
|
|
242
|
+
* Services are only available if their URL is configured. Accessing a service
|
|
243
|
+
* without a configured URL will throw an error.
|
|
244
|
+
*
|
|
245
|
+
* @example Basic usage with multiple services
|
|
246
|
+
* ```typescript
|
|
247
|
+
* // app.config.ts
|
|
248
|
+
* import { ApplicationConfig } from '@angular/core';
|
|
249
|
+
* import { provideBlocks23 } from '@23blocks/angular';
|
|
250
|
+
*
|
|
251
|
+
* export const appConfig: ApplicationConfig = {
|
|
252
|
+
* providers: [
|
|
253
|
+
* provideBlocks23({
|
|
254
|
+
* appId: 'your-app-id',
|
|
255
|
+
* urls: {
|
|
256
|
+
* authentication: 'https://gateway.23blocks.com',
|
|
257
|
+
* crm: 'https://crm.23blocks.com',
|
|
258
|
+
* products: 'https://products.23blocks.com',
|
|
259
|
+
* },
|
|
260
|
+
* }),
|
|
261
|
+
* ],
|
|
262
|
+
* };
|
|
263
|
+
* ```
|
|
264
|
+
*
|
|
265
|
+
* @example Cookie mode (recommended for security)
|
|
266
|
+
* ```typescript
|
|
267
|
+
* export const appConfig: ApplicationConfig = {
|
|
268
|
+
* providers: [
|
|
269
|
+
* provideBlocks23({
|
|
270
|
+
* appId: 'your-app-id',
|
|
271
|
+
* authMode: 'cookie',
|
|
272
|
+
* urls: {
|
|
273
|
+
* authentication: 'https://gateway.23blocks.com',
|
|
274
|
+
* crm: 'https://crm.23blocks.com',
|
|
275
|
+
* },
|
|
276
|
+
* }),
|
|
277
|
+
* ],
|
|
278
|
+
* };
|
|
279
|
+
* ```
|
|
280
|
+
*/ function provideBlocks23(config) {
|
|
281
|
+
// Block config for all services
|
|
282
|
+
const blockConfig = {
|
|
283
|
+
appId: config.appId,
|
|
284
|
+
tenantId: config.tenantId
|
|
285
|
+
};
|
|
286
|
+
// Helper to create transport provider for a service URL
|
|
287
|
+
const createTransportProvider = (token, url)=>({
|
|
288
|
+
provide: token,
|
|
289
|
+
useFactory: (tokenManager)=>{
|
|
290
|
+
if (!url) return null;
|
|
291
|
+
return createTransportWithAuth(url, config, tokenManager);
|
|
292
|
+
},
|
|
293
|
+
deps: [
|
|
294
|
+
TOKEN_MANAGER
|
|
295
|
+
]
|
|
296
|
+
});
|
|
297
|
+
const providers = [
|
|
298
|
+
// Store config for injection
|
|
299
|
+
{
|
|
300
|
+
provide: PROVIDER_CONFIG,
|
|
301
|
+
useValue: config
|
|
302
|
+
},
|
|
303
|
+
// Token manager factory - creates singleton within the injector
|
|
304
|
+
{
|
|
305
|
+
provide: TOKEN_MANAGER,
|
|
306
|
+
useFactory: ()=>{
|
|
307
|
+
var _config_storage;
|
|
308
|
+
const storage = (_config_storage = config.storage) != null ? _config_storage : 'localStorage';
|
|
309
|
+
return createTokenManager(config.appId, storage, config.tenantId);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
// Per-service transport factories (null if URL not configured)
|
|
313
|
+
createTransportProvider(AUTHENTICATION_TRANSPORT, config.urls.authentication),
|
|
314
|
+
createTransportProvider(SEARCH_TRANSPORT, config.urls.search),
|
|
315
|
+
createTransportProvider(PRODUCTS_TRANSPORT, config.urls.products),
|
|
316
|
+
createTransportProvider(CRM_TRANSPORT, config.urls.crm),
|
|
317
|
+
createTransportProvider(CONTENT_TRANSPORT, config.urls.content),
|
|
318
|
+
createTransportProvider(GEOLOCATION_TRANSPORT, config.urls.geolocation),
|
|
319
|
+
createTransportProvider(CONVERSATIONS_TRANSPORT, config.urls.conversations),
|
|
320
|
+
createTransportProvider(FILES_TRANSPORT, config.urls.files),
|
|
321
|
+
createTransportProvider(FORMS_TRANSPORT, config.urls.forms),
|
|
322
|
+
createTransportProvider(ASSETS_TRANSPORT, config.urls.assets),
|
|
323
|
+
createTransportProvider(CAMPAIGNS_TRANSPORT, config.urls.campaigns),
|
|
324
|
+
createTransportProvider(COMPANY_TRANSPORT, config.urls.company),
|
|
325
|
+
createTransportProvider(REWARDS_TRANSPORT, config.urls.rewards),
|
|
326
|
+
createTransportProvider(SALES_TRANSPORT, config.urls.sales),
|
|
327
|
+
createTransportProvider(WALLET_TRANSPORT, config.urls.wallet),
|
|
328
|
+
createTransportProvider(JARVIS_TRANSPORT, config.urls.jarvis),
|
|
329
|
+
createTransportProvider(ONBOARDING_TRANSPORT, config.urls.onboarding),
|
|
330
|
+
createTransportProvider(UNIVERSITY_TRANSPORT, config.urls.university),
|
|
331
|
+
// Backward compatibility: provide TRANSPORT token using auth URL if available
|
|
332
|
+
// (for advanced API users who still inject TRANSPORT directly)
|
|
333
|
+
{
|
|
334
|
+
provide: TRANSPORT,
|
|
335
|
+
useFactory: (tokenManager)=>{
|
|
336
|
+
// Use auth URL if available, otherwise create a dummy transport that throws
|
|
337
|
+
const url = config.urls.authentication;
|
|
338
|
+
if (url) {
|
|
339
|
+
return createTransportWithAuth(url, config, tokenManager);
|
|
340
|
+
}
|
|
341
|
+
// Return a transport that throws helpful errors
|
|
342
|
+
return {
|
|
343
|
+
request: ()=>{
|
|
344
|
+
throw new Error('[23blocks] TRANSPORT is not configured. ' + 'Use per-service transport tokens or configure urls.authentication.');
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
deps: [
|
|
349
|
+
TOKEN_MANAGER
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
// Block configs
|
|
353
|
+
{
|
|
354
|
+
provide: AUTHENTICATION_CONFIG,
|
|
355
|
+
useValue: blockConfig
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
provide: SEARCH_CONFIG,
|
|
359
|
+
useValue: blockConfig
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
provide: PRODUCTS_CONFIG,
|
|
363
|
+
useValue: blockConfig
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
provide: CRM_CONFIG,
|
|
367
|
+
useValue: blockConfig
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
provide: CONTENT_CONFIG,
|
|
371
|
+
useValue: blockConfig
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
provide: GEOLOCATION_CONFIG,
|
|
375
|
+
useValue: blockConfig
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
provide: CONVERSATIONS_CONFIG,
|
|
379
|
+
useValue: blockConfig
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
provide: FILES_CONFIG,
|
|
383
|
+
useValue: blockConfig
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
provide: FORMS_CONFIG,
|
|
387
|
+
useValue: blockConfig
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
provide: ASSETS_CONFIG,
|
|
391
|
+
useValue: blockConfig
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
provide: CAMPAIGNS_CONFIG,
|
|
395
|
+
useValue: blockConfig
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
provide: COMPANY_CONFIG,
|
|
399
|
+
useValue: blockConfig
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
provide: REWARDS_CONFIG,
|
|
403
|
+
useValue: blockConfig
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
provide: SALES_CONFIG,
|
|
407
|
+
useValue: blockConfig
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
provide: WALLET_CONFIG,
|
|
411
|
+
useValue: blockConfig
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
provide: JARVIS_CONFIG,
|
|
415
|
+
useValue: blockConfig
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
provide: ONBOARDING_CONFIG,
|
|
419
|
+
useValue: blockConfig
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
provide: UNIVERSITY_CONFIG,
|
|
423
|
+
useValue: blockConfig
|
|
424
|
+
}
|
|
425
|
+
];
|
|
426
|
+
return makeEnvironmentProviders(providers);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Get providers array for NgModule-based applications with simplified config.
|
|
430
|
+
*
|
|
431
|
+
* Services are only available if their URL is configured. Accessing a service
|
|
432
|
+
* without a configured URL will throw an error.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```typescript
|
|
436
|
+
* // app.module.ts
|
|
437
|
+
* import { NgModule } from '@angular/core';
|
|
438
|
+
* import { getBlocks23Providers } from '@23blocks/angular';
|
|
439
|
+
*
|
|
440
|
+
* @NgModule({
|
|
441
|
+
* providers: [
|
|
442
|
+
* ...getBlocks23Providers({
|
|
443
|
+
* appId: 'your-app-id',
|
|
444
|
+
* urls: {
|
|
445
|
+
* authentication: 'https://gateway.23blocks.com',
|
|
446
|
+
* crm: 'https://crm.23blocks.com',
|
|
447
|
+
* },
|
|
448
|
+
* }),
|
|
449
|
+
* ],
|
|
450
|
+
* })
|
|
451
|
+
* export class AppModule {}
|
|
452
|
+
* ```
|
|
453
|
+
*/ function getBlocks23Providers(config) {
|
|
454
|
+
// Block config for all services
|
|
455
|
+
const blockConfig = {
|
|
456
|
+
appId: config.appId,
|
|
457
|
+
tenantId: config.tenantId
|
|
458
|
+
};
|
|
459
|
+
// Helper to create transport provider for a service URL
|
|
460
|
+
const createTransportProvider = (token, url)=>({
|
|
461
|
+
provide: token,
|
|
462
|
+
useFactory: (tokenManager)=>{
|
|
463
|
+
if (!url) return null;
|
|
464
|
+
return createTransportWithAuth(url, config, tokenManager);
|
|
465
|
+
},
|
|
466
|
+
deps: [
|
|
467
|
+
TOKEN_MANAGER
|
|
468
|
+
]
|
|
469
|
+
});
|
|
470
|
+
return [
|
|
471
|
+
// Store config for injection
|
|
472
|
+
{
|
|
473
|
+
provide: PROVIDER_CONFIG,
|
|
474
|
+
useValue: config
|
|
475
|
+
},
|
|
476
|
+
// Token manager factory - creates singleton within the injector
|
|
477
|
+
{
|
|
478
|
+
provide: TOKEN_MANAGER,
|
|
479
|
+
useFactory: ()=>{
|
|
480
|
+
var _config_storage;
|
|
481
|
+
const storage = (_config_storage = config.storage) != null ? _config_storage : 'localStorage';
|
|
482
|
+
return createTokenManager(config.appId, storage, config.tenantId);
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
// Per-service transport factories (null if URL not configured)
|
|
486
|
+
createTransportProvider(AUTHENTICATION_TRANSPORT, config.urls.authentication),
|
|
487
|
+
createTransportProvider(SEARCH_TRANSPORT, config.urls.search),
|
|
488
|
+
createTransportProvider(PRODUCTS_TRANSPORT, config.urls.products),
|
|
489
|
+
createTransportProvider(CRM_TRANSPORT, config.urls.crm),
|
|
490
|
+
createTransportProvider(CONTENT_TRANSPORT, config.urls.content),
|
|
491
|
+
createTransportProvider(GEOLOCATION_TRANSPORT, config.urls.geolocation),
|
|
492
|
+
createTransportProvider(CONVERSATIONS_TRANSPORT, config.urls.conversations),
|
|
493
|
+
createTransportProvider(FILES_TRANSPORT, config.urls.files),
|
|
494
|
+
createTransportProvider(FORMS_TRANSPORT, config.urls.forms),
|
|
495
|
+
createTransportProvider(ASSETS_TRANSPORT, config.urls.assets),
|
|
496
|
+
createTransportProvider(CAMPAIGNS_TRANSPORT, config.urls.campaigns),
|
|
497
|
+
createTransportProvider(COMPANY_TRANSPORT, config.urls.company),
|
|
498
|
+
createTransportProvider(REWARDS_TRANSPORT, config.urls.rewards),
|
|
499
|
+
createTransportProvider(SALES_TRANSPORT, config.urls.sales),
|
|
500
|
+
createTransportProvider(WALLET_TRANSPORT, config.urls.wallet),
|
|
501
|
+
createTransportProvider(JARVIS_TRANSPORT, config.urls.jarvis),
|
|
502
|
+
createTransportProvider(ONBOARDING_TRANSPORT, config.urls.onboarding),
|
|
503
|
+
createTransportProvider(UNIVERSITY_TRANSPORT, config.urls.university),
|
|
504
|
+
// Backward compatibility: provide TRANSPORT token using auth URL if available
|
|
505
|
+
{
|
|
506
|
+
provide: TRANSPORT,
|
|
507
|
+
useFactory: (tokenManager)=>{
|
|
508
|
+
const url = config.urls.authentication;
|
|
509
|
+
if (url) {
|
|
510
|
+
return createTransportWithAuth(url, config, tokenManager);
|
|
511
|
+
}
|
|
512
|
+
return {
|
|
513
|
+
request: ()=>{
|
|
514
|
+
throw new Error('[23blocks] TRANSPORT is not configured. ' + 'Use per-service transport tokens or configure urls.authentication.');
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
},
|
|
518
|
+
deps: [
|
|
519
|
+
TOKEN_MANAGER
|
|
520
|
+
]
|
|
521
|
+
},
|
|
522
|
+
// Block configs
|
|
523
|
+
{
|
|
524
|
+
provide: AUTHENTICATION_CONFIG,
|
|
525
|
+
useValue: blockConfig
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
provide: SEARCH_CONFIG,
|
|
529
|
+
useValue: blockConfig
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
provide: PRODUCTS_CONFIG,
|
|
533
|
+
useValue: blockConfig
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
provide: CRM_CONFIG,
|
|
537
|
+
useValue: blockConfig
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
provide: CONTENT_CONFIG,
|
|
541
|
+
useValue: blockConfig
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
provide: GEOLOCATION_CONFIG,
|
|
545
|
+
useValue: blockConfig
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
provide: CONVERSATIONS_CONFIG,
|
|
549
|
+
useValue: blockConfig
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
provide: FILES_CONFIG,
|
|
553
|
+
useValue: blockConfig
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
provide: FORMS_CONFIG,
|
|
557
|
+
useValue: blockConfig
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
provide: ASSETS_CONFIG,
|
|
561
|
+
useValue: blockConfig
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
provide: CAMPAIGNS_CONFIG,
|
|
565
|
+
useValue: blockConfig
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
provide: COMPANY_CONFIG,
|
|
569
|
+
useValue: blockConfig
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
provide: REWARDS_CONFIG,
|
|
573
|
+
useValue: blockConfig
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
provide: SALES_CONFIG,
|
|
577
|
+
useValue: blockConfig
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
provide: WALLET_CONFIG,
|
|
581
|
+
useValue: blockConfig
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
provide: JARVIS_CONFIG,
|
|
585
|
+
useValue: blockConfig
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
provide: ONBOARDING_CONFIG,
|
|
589
|
+
useValue: blockConfig
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
provide: UNIVERSITY_CONFIG,
|
|
593
|
+
useValue: blockConfig
|
|
594
|
+
}
|
|
595
|
+
];
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Provide 23blocks services for standalone Angular applications.
|
|
600
|
+
*
|
|
601
|
+
* @example
|
|
602
|
+
* ```typescript
|
|
603
|
+
* // app.config.ts
|
|
604
|
+
* import { ApplicationConfig } from '@angular/core';
|
|
605
|
+
* import { provide23Blocks } from '@23blocks/angular';
|
|
606
|
+
* import { createHttpTransport } from '@23blocks/transport-http';
|
|
607
|
+
*
|
|
608
|
+
* const transport = createHttpTransport({
|
|
609
|
+
* baseUrl: 'https://api.example.com',
|
|
610
|
+
* headers: () => ({
|
|
611
|
+
* 'Authorization': `Bearer ${localStorage.getItem('token')}`,
|
|
612
|
+
* }),
|
|
613
|
+
* });
|
|
614
|
+
*
|
|
615
|
+
* export const appConfig: ApplicationConfig = {
|
|
616
|
+
* providers: [
|
|
617
|
+
* provide23Blocks({
|
|
618
|
+
* transport,
|
|
619
|
+
* authentication: { appId: 'my-app' },
|
|
620
|
+
* search: { appId: 'my-app' },
|
|
621
|
+
* products: { appId: 'my-app' },
|
|
622
|
+
* crm: { appId: 'my-app' },
|
|
623
|
+
* }),
|
|
624
|
+
* ],
|
|
625
|
+
* };
|
|
626
|
+
* ```
|
|
627
|
+
*/ function provide23Blocks(config) {
|
|
628
|
+
const providers = [
|
|
629
|
+
{
|
|
630
|
+
provide: TRANSPORT,
|
|
631
|
+
useValue: config.transport
|
|
632
|
+
}
|
|
633
|
+
];
|
|
634
|
+
if (config.authentication) {
|
|
635
|
+
providers.push({
|
|
636
|
+
provide: AUTHENTICATION_CONFIG,
|
|
637
|
+
useValue: config.authentication
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
if (config.search) {
|
|
641
|
+
providers.push({
|
|
642
|
+
provide: SEARCH_CONFIG,
|
|
643
|
+
useValue: config.search
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
if (config.products) {
|
|
647
|
+
providers.push({
|
|
648
|
+
provide: PRODUCTS_CONFIG,
|
|
649
|
+
useValue: config.products
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
if (config.crm) {
|
|
653
|
+
providers.push({
|
|
654
|
+
provide: CRM_CONFIG,
|
|
655
|
+
useValue: config.crm
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
if (config.content) {
|
|
659
|
+
providers.push({
|
|
660
|
+
provide: CONTENT_CONFIG,
|
|
661
|
+
useValue: config.content
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
if (config.geolocation) {
|
|
665
|
+
providers.push({
|
|
666
|
+
provide: GEOLOCATION_CONFIG,
|
|
667
|
+
useValue: config.geolocation
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
if (config.conversations) {
|
|
671
|
+
providers.push({
|
|
672
|
+
provide: CONVERSATIONS_CONFIG,
|
|
673
|
+
useValue: config.conversations
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
if (config.files) {
|
|
677
|
+
providers.push({
|
|
678
|
+
provide: FILES_CONFIG,
|
|
679
|
+
useValue: config.files
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
if (config.forms) {
|
|
683
|
+
providers.push({
|
|
684
|
+
provide: FORMS_CONFIG,
|
|
685
|
+
useValue: config.forms
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
if (config.assets) {
|
|
689
|
+
providers.push({
|
|
690
|
+
provide: ASSETS_CONFIG,
|
|
691
|
+
useValue: config.assets
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
if (config.campaigns) {
|
|
695
|
+
providers.push({
|
|
696
|
+
provide: CAMPAIGNS_CONFIG,
|
|
697
|
+
useValue: config.campaigns
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
if (config.company) {
|
|
701
|
+
providers.push({
|
|
702
|
+
provide: COMPANY_CONFIG,
|
|
703
|
+
useValue: config.company
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
if (config.rewards) {
|
|
707
|
+
providers.push({
|
|
708
|
+
provide: REWARDS_CONFIG,
|
|
709
|
+
useValue: config.rewards
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
if (config.sales) {
|
|
713
|
+
providers.push({
|
|
714
|
+
provide: SALES_CONFIG,
|
|
715
|
+
useValue: config.sales
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
if (config.wallet) {
|
|
719
|
+
providers.push({
|
|
720
|
+
provide: WALLET_CONFIG,
|
|
721
|
+
useValue: config.wallet
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
if (config.jarvis) {
|
|
725
|
+
providers.push({
|
|
726
|
+
provide: JARVIS_CONFIG,
|
|
727
|
+
useValue: config.jarvis
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
if (config.onboarding) {
|
|
731
|
+
providers.push({
|
|
732
|
+
provide: ONBOARDING_CONFIG,
|
|
733
|
+
useValue: config.onboarding
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
if (config.university) {
|
|
737
|
+
providers.push({
|
|
738
|
+
provide: UNIVERSITY_CONFIG,
|
|
739
|
+
useValue: config.university
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
return makeEnvironmentProviders(providers);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Get providers array for NgModule-based applications.
|
|
746
|
+
*
|
|
747
|
+
* @example
|
|
748
|
+
* ```typescript
|
|
749
|
+
* // app.module.ts
|
|
750
|
+
* import { NgModule } from '@angular/core';
|
|
751
|
+
* import { get23BlocksProviders } from '@23blocks/angular';
|
|
752
|
+
*
|
|
753
|
+
* @NgModule({
|
|
754
|
+
* providers: [
|
|
755
|
+
* ...get23BlocksProviders({
|
|
756
|
+
* transport,
|
|
757
|
+
* authentication: { appId: 'my-app' },
|
|
758
|
+
* }),
|
|
759
|
+
* ],
|
|
760
|
+
* })
|
|
761
|
+
* export class AppModule {}
|
|
762
|
+
* ```
|
|
763
|
+
*/ function get23BlocksProviders(config) {
|
|
764
|
+
const providers = [
|
|
765
|
+
{
|
|
766
|
+
provide: TRANSPORT,
|
|
767
|
+
useValue: config.transport
|
|
768
|
+
}
|
|
769
|
+
];
|
|
770
|
+
if (config.authentication) {
|
|
771
|
+
providers.push({
|
|
772
|
+
provide: AUTHENTICATION_CONFIG,
|
|
773
|
+
useValue: config.authentication
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
if (config.search) {
|
|
777
|
+
providers.push({
|
|
778
|
+
provide: SEARCH_CONFIG,
|
|
779
|
+
useValue: config.search
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
if (config.products) {
|
|
783
|
+
providers.push({
|
|
784
|
+
provide: PRODUCTS_CONFIG,
|
|
785
|
+
useValue: config.products
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
if (config.crm) {
|
|
789
|
+
providers.push({
|
|
790
|
+
provide: CRM_CONFIG,
|
|
791
|
+
useValue: config.crm
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
if (config.content) {
|
|
795
|
+
providers.push({
|
|
796
|
+
provide: CONTENT_CONFIG,
|
|
797
|
+
useValue: config.content
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
if (config.geolocation) {
|
|
801
|
+
providers.push({
|
|
802
|
+
provide: GEOLOCATION_CONFIG,
|
|
803
|
+
useValue: config.geolocation
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
if (config.conversations) {
|
|
807
|
+
providers.push({
|
|
808
|
+
provide: CONVERSATIONS_CONFIG,
|
|
809
|
+
useValue: config.conversations
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
if (config.files) {
|
|
813
|
+
providers.push({
|
|
814
|
+
provide: FILES_CONFIG,
|
|
815
|
+
useValue: config.files
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
if (config.forms) {
|
|
819
|
+
providers.push({
|
|
820
|
+
provide: FORMS_CONFIG,
|
|
821
|
+
useValue: config.forms
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
if (config.assets) {
|
|
825
|
+
providers.push({
|
|
826
|
+
provide: ASSETS_CONFIG,
|
|
827
|
+
useValue: config.assets
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
if (config.campaigns) {
|
|
831
|
+
providers.push({
|
|
832
|
+
provide: CAMPAIGNS_CONFIG,
|
|
833
|
+
useValue: config.campaigns
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
if (config.company) {
|
|
837
|
+
providers.push({
|
|
838
|
+
provide: COMPANY_CONFIG,
|
|
839
|
+
useValue: config.company
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
if (config.rewards) {
|
|
843
|
+
providers.push({
|
|
844
|
+
provide: REWARDS_CONFIG,
|
|
845
|
+
useValue: config.rewards
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
if (config.sales) {
|
|
849
|
+
providers.push({
|
|
850
|
+
provide: SALES_CONFIG,
|
|
851
|
+
useValue: config.sales
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
if (config.wallet) {
|
|
855
|
+
providers.push({
|
|
856
|
+
provide: WALLET_CONFIG,
|
|
857
|
+
useValue: config.wallet
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
if (config.jarvis) {
|
|
861
|
+
providers.push({
|
|
862
|
+
provide: JARVIS_CONFIG,
|
|
863
|
+
useValue: config.jarvis
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
if (config.onboarding) {
|
|
867
|
+
providers.push({
|
|
868
|
+
provide: ONBOARDING_CONFIG,
|
|
869
|
+
useValue: config.onboarding
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
if (config.university) {
|
|
873
|
+
providers.push({
|
|
874
|
+
provide: UNIVERSITY_CONFIG,
|
|
875
|
+
useValue: config.university
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
return providers;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function _type_of(obj) {
|
|
882
|
+
"@swc/helpers - typeof";
|
|
883
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
884
|
+
}
|
|
885
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
886
|
+
function accept(f) {
|
|
887
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
888
|
+
return f;
|
|
889
|
+
}
|
|
890
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
891
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
892
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
893
|
+
var _, done = false;
|
|
894
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
895
|
+
var context = {};
|
|
896
|
+
for(var p in contextIn)context[p] = p === "access" ? {} : contextIn[p];
|
|
897
|
+
for(var p in contextIn.access)context.access[p] = contextIn.access[p];
|
|
898
|
+
context.addInitializer = function(f) {
|
|
899
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
900
|
+
extraInitializers.push(accept(f || null));
|
|
901
|
+
};
|
|
902
|
+
var result = (0, decorators[i])(kind === "accessor" ? {
|
|
903
|
+
get: descriptor.get,
|
|
904
|
+
set: descriptor.set
|
|
905
|
+
} : descriptor[key], context);
|
|
906
|
+
if (kind === "accessor") {
|
|
907
|
+
if (result === void 0) continue;
|
|
908
|
+
if (result === null || (typeof result === "undefined" ? "undefined" : _type_of(result)) !== "object") throw new TypeError("Object expected");
|
|
909
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
910
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
911
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
912
|
+
} else if (_ = accept(result)) {
|
|
913
|
+
if (kind === "field") initializers.unshift(_);
|
|
914
|
+
else descriptor[key] = _;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
918
|
+
done = true;
|
|
919
|
+
}
|
|
920
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
921
|
+
var useValue = arguments.length > 2;
|
|
922
|
+
for(var i = 0; i < initializers.length; i++){
|
|
923
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
924
|
+
}
|
|
925
|
+
return useValue ? value : void 0;
|
|
926
|
+
}
|
|
927
|
+
typeof SuppressedError === "function" ? SuppressedError : function _SuppressedError(error, suppressed, message) {
|
|
928
|
+
var e = new Error(message);
|
|
929
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Angular service wrapping the Authentication block.
|
|
934
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```typescript
|
|
938
|
+
* @Component({...})
|
|
939
|
+
* export class LoginComponent {
|
|
940
|
+
* constructor(private auth: AuthenticationService) {}
|
|
941
|
+
*
|
|
942
|
+
* login(email: string, password: string) {
|
|
943
|
+
* this.auth.signIn({ email, password }).subscribe({
|
|
944
|
+
* next: (response) => console.log('Signed in:', response.user),
|
|
945
|
+
* error: (err) => console.error('Failed:', err),
|
|
946
|
+
* });
|
|
947
|
+
* }
|
|
948
|
+
* }
|
|
949
|
+
* ```
|
|
950
|
+
*/ let AuthenticationService = (()=>{
|
|
951
|
+
var _class;
|
|
952
|
+
let _classDecorators = [
|
|
953
|
+
Injectable({
|
|
954
|
+
providedIn: 'root'
|
|
955
|
+
})
|
|
956
|
+
];
|
|
957
|
+
let _classDescriptor;
|
|
958
|
+
let _classExtraInitializers = [];
|
|
959
|
+
let _classThis;
|
|
960
|
+
(_class = class {
|
|
961
|
+
/**
|
|
962
|
+
* Ensure the service is configured, throw helpful error if not
|
|
963
|
+
*/ ensureConfigured() {
|
|
964
|
+
if (!this.block) {
|
|
965
|
+
throw new Error('[23blocks] AuthenticationService is not configured. ' + "Add 'urls.authentication' to your provideBlocks23() configuration.");
|
|
966
|
+
}
|
|
967
|
+
return this.block;
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Check if using simplified API with automatic token management
|
|
971
|
+
*/ get isTokenMode() {
|
|
972
|
+
var _this_simpleConfig;
|
|
973
|
+
return this.tokenManager !== null && ((_this_simpleConfig = this.simpleConfig) == null ? void 0 : _this_simpleConfig.authMode) !== 'cookie';
|
|
974
|
+
}
|
|
975
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
976
|
+
// Auth Service
|
|
977
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
978
|
+
/**
|
|
979
|
+
* Sign in with email and password.
|
|
980
|
+
* When using simplified API (provideBlocks23), tokens are stored automatically.
|
|
981
|
+
*/ signIn(request) {
|
|
982
|
+
const block = this.ensureConfigured();
|
|
983
|
+
return from(block.auth.signIn(request)).pipe(tap((response)=>{
|
|
984
|
+
if (this.isTokenMode && this.tokenManager && response.accessToken) {
|
|
985
|
+
this.tokenManager.setTokens(response.accessToken, response.refreshToken);
|
|
986
|
+
}
|
|
987
|
+
}));
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Sign up a new user.
|
|
991
|
+
* When using simplified API, tokens are stored automatically if returned.
|
|
992
|
+
*/ signUp(request) {
|
|
993
|
+
const block = this.ensureConfigured();
|
|
994
|
+
return from(block.auth.signUp(request)).pipe(tap((response)=>{
|
|
995
|
+
if (this.isTokenMode && this.tokenManager && response.accessToken) {
|
|
996
|
+
this.tokenManager.setTokens(response.accessToken);
|
|
997
|
+
}
|
|
998
|
+
}));
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Sign out the current user.
|
|
1002
|
+
* When using simplified API, tokens are cleared automatically.
|
|
1003
|
+
*/ signOut() {
|
|
1004
|
+
const block = this.ensureConfigured();
|
|
1005
|
+
return from(block.auth.signOut()).pipe(tap(()=>{
|
|
1006
|
+
if (this.isTokenMode && this.tokenManager) {
|
|
1007
|
+
this.tokenManager.clearTokens();
|
|
1008
|
+
}
|
|
1009
|
+
}));
|
|
1010
|
+
}
|
|
1011
|
+
requestPasswordReset(request) {
|
|
1012
|
+
return from(this.ensureConfigured().auth.requestPasswordReset(request));
|
|
1013
|
+
}
|
|
1014
|
+
updatePassword(request) {
|
|
1015
|
+
return from(this.ensureConfigured().auth.updatePassword(request));
|
|
1016
|
+
}
|
|
1017
|
+
validateToken(token) {
|
|
1018
|
+
return from(this.ensureConfigured().auth.validateToken(token));
|
|
1019
|
+
}
|
|
1020
|
+
getCurrentUser() {
|
|
1021
|
+
return from(this.ensureConfigured().auth.getCurrentUser());
|
|
1022
|
+
}
|
|
1023
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1024
|
+
// Users Service
|
|
1025
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1026
|
+
listUsers(params) {
|
|
1027
|
+
return from(this.ensureConfigured().users.list(params));
|
|
1028
|
+
}
|
|
1029
|
+
getUser(id) {
|
|
1030
|
+
return from(this.ensureConfigured().users.get(id));
|
|
1031
|
+
}
|
|
1032
|
+
updateUser(id, request) {
|
|
1033
|
+
return from(this.ensureConfigured().users.update(id, request));
|
|
1034
|
+
}
|
|
1035
|
+
deleteUser(id) {
|
|
1036
|
+
return from(this.ensureConfigured().users.delete(id));
|
|
1037
|
+
}
|
|
1038
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1039
|
+
// Roles Service
|
|
1040
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1041
|
+
listRoles() {
|
|
1042
|
+
return from(this.ensureConfigured().roles.list());
|
|
1043
|
+
}
|
|
1044
|
+
getRole(id) {
|
|
1045
|
+
return from(this.ensureConfigured().roles.get(id));
|
|
1046
|
+
}
|
|
1047
|
+
createRole(request) {
|
|
1048
|
+
return from(this.ensureConfigured().roles.create(request));
|
|
1049
|
+
}
|
|
1050
|
+
updateRole(id, request) {
|
|
1051
|
+
return from(this.ensureConfigured().roles.update(id, request));
|
|
1052
|
+
}
|
|
1053
|
+
deleteRole(id) {
|
|
1054
|
+
return from(this.ensureConfigured().roles.delete(id));
|
|
1055
|
+
}
|
|
1056
|
+
listPermissions() {
|
|
1057
|
+
return from(this.ensureConfigured().roles.listPermissions());
|
|
1058
|
+
}
|
|
1059
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1060
|
+
// API Keys Service
|
|
1061
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1062
|
+
listApiKeys() {
|
|
1063
|
+
return from(this.ensureConfigured().apiKeys.list());
|
|
1064
|
+
}
|
|
1065
|
+
getApiKey(id) {
|
|
1066
|
+
return from(this.ensureConfigured().apiKeys.get(id));
|
|
1067
|
+
}
|
|
1068
|
+
createApiKey(request) {
|
|
1069
|
+
return from(this.ensureConfigured().apiKeys.create(request));
|
|
1070
|
+
}
|
|
1071
|
+
updateApiKey(id, request) {
|
|
1072
|
+
return from(this.ensureConfigured().apiKeys.update(id, request));
|
|
1073
|
+
}
|
|
1074
|
+
revokeApiKey(id) {
|
|
1075
|
+
return from(this.ensureConfigured().apiKeys.revoke(id));
|
|
1076
|
+
}
|
|
1077
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1078
|
+
// Token Management (only applicable with provideBlocks23)
|
|
1079
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1080
|
+
/**
|
|
1081
|
+
* Get the current access token (token mode only).
|
|
1082
|
+
* Returns null if using cookie mode or no token is stored.
|
|
1083
|
+
*/ getAccessToken() {
|
|
1084
|
+
var _this_tokenManager;
|
|
1085
|
+
var _this_tokenManager_getAccessToken;
|
|
1086
|
+
return (_this_tokenManager_getAccessToken = (_this_tokenManager = this.tokenManager) == null ? void 0 : _this_tokenManager.getAccessToken()) != null ? _this_tokenManager_getAccessToken : null;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Get the current refresh token (token mode only).
|
|
1090
|
+
* Returns null if using cookie mode or no token is stored.
|
|
1091
|
+
*/ getRefreshToken() {
|
|
1092
|
+
var _this_tokenManager;
|
|
1093
|
+
var _this_tokenManager_getRefreshToken;
|
|
1094
|
+
return (_this_tokenManager_getRefreshToken = (_this_tokenManager = this.tokenManager) == null ? void 0 : _this_tokenManager.getRefreshToken()) != null ? _this_tokenManager_getRefreshToken : null;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Manually set tokens (token mode only).
|
|
1098
|
+
* Useful for SSR hydration or external auth flows.
|
|
1099
|
+
*/ setTokens(accessToken, refreshToken) {
|
|
1100
|
+
var _this_tokenManager;
|
|
1101
|
+
(_this_tokenManager = this.tokenManager) == null ? void 0 : _this_tokenManager.setTokens(accessToken, refreshToken);
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Clear stored tokens.
|
|
1105
|
+
*/ clearTokens() {
|
|
1106
|
+
var _this_tokenManager;
|
|
1107
|
+
(_this_tokenManager = this.tokenManager) == null ? void 0 : _this_tokenManager.clearTokens();
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Check if user is likely authenticated.
|
|
1111
|
+
* In token mode: checks if token exists.
|
|
1112
|
+
* In cookie mode: always returns null (use validateToken instead).
|
|
1113
|
+
*/ isAuthenticated() {
|
|
1114
|
+
var _this_simpleConfig;
|
|
1115
|
+
if (!this.tokenManager || ((_this_simpleConfig = this.simpleConfig) == null ? void 0 : _this_simpleConfig.authMode) === 'cookie') {
|
|
1116
|
+
return null;
|
|
1117
|
+
}
|
|
1118
|
+
return !!this.tokenManager.getAccessToken();
|
|
1119
|
+
}
|
|
1120
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1121
|
+
// Direct Block Access (for advanced usage)
|
|
1122
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1123
|
+
/**
|
|
1124
|
+
* Access the underlying block for advanced operations
|
|
1125
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
1126
|
+
*/ get rawBlock() {
|
|
1127
|
+
return this.ensureConfigured();
|
|
1128
|
+
}
|
|
1129
|
+
constructor(serviceTransport, legacyTransport, config, tokenManager, simpleConfig){
|
|
1130
|
+
// Prefer per-service transport, fall back to legacy TRANSPORT for backward compatibility
|
|
1131
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
1132
|
+
this.block = transport ? createAuthenticationBlock(transport, config) : null;
|
|
1133
|
+
this.tokenManager = tokenManager;
|
|
1134
|
+
this.simpleConfig = simpleConfig;
|
|
1135
|
+
}
|
|
1136
|
+
}, _classThis = _class, (()=>{
|
|
1137
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1138
|
+
__esDecorate(null, _classDescriptor = {
|
|
1139
|
+
value: _classThis
|
|
1140
|
+
}, _classDecorators, {
|
|
1141
|
+
kind: "class",
|
|
1142
|
+
name: _classThis.name,
|
|
1143
|
+
metadata: _metadata
|
|
1144
|
+
}, null, _classExtraInitializers);
|
|
1145
|
+
_classThis = _classDescriptor.value;
|
|
1146
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
1147
|
+
enumerable: true,
|
|
1148
|
+
configurable: true,
|
|
1149
|
+
writable: true,
|
|
1150
|
+
value: _metadata
|
|
1151
|
+
});
|
|
1152
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1153
|
+
})(), _class);
|
|
1154
|
+
return _classThis;
|
|
1155
|
+
})();
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Angular service wrapping the Search block.
|
|
1159
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
1160
|
+
*
|
|
1161
|
+
* @example
|
|
1162
|
+
* ```typescript
|
|
1163
|
+
* @Component({...})
|
|
1164
|
+
* export class SearchComponent {
|
|
1165
|
+
* results$ = new BehaviorSubject<SearchResult[]>([]);
|
|
1166
|
+
*
|
|
1167
|
+
* constructor(private searchService: SearchService) {}
|
|
1168
|
+
*
|
|
1169
|
+
* onSearch(query: string) {
|
|
1170
|
+
* this.searchService.search({ query }).subscribe({
|
|
1171
|
+
* next: (response) => this.results$.next(response.results),
|
|
1172
|
+
* error: (err) => console.error('Search failed:', err),
|
|
1173
|
+
* });
|
|
1174
|
+
* }
|
|
1175
|
+
* }
|
|
1176
|
+
* ```
|
|
1177
|
+
*/ let SearchService = (()=>{
|
|
1178
|
+
var _class;
|
|
1179
|
+
let _classDecorators = [
|
|
1180
|
+
Injectable({
|
|
1181
|
+
providedIn: 'root'
|
|
1182
|
+
})
|
|
1183
|
+
];
|
|
1184
|
+
let _classDescriptor;
|
|
1185
|
+
let _classExtraInitializers = [];
|
|
1186
|
+
let _classThis;
|
|
1187
|
+
(_class = class {
|
|
1188
|
+
/**
|
|
1189
|
+
* Ensure the service is configured, throw helpful error if not
|
|
1190
|
+
*/ ensureConfigured() {
|
|
1191
|
+
if (!this.block) {
|
|
1192
|
+
throw new Error('[23blocks] SearchService is not configured. ' + "Add 'urls.search' to your provideBlocks23() configuration.");
|
|
1193
|
+
}
|
|
1194
|
+
return this.block;
|
|
1195
|
+
}
|
|
1196
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1197
|
+
// Search Operations
|
|
1198
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1199
|
+
/**
|
|
1200
|
+
* Perform a search query
|
|
1201
|
+
*/ search(request) {
|
|
1202
|
+
return from(this.ensureConfigured().search.search(request));
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Get search suggestions for autocomplete
|
|
1206
|
+
*/ suggest(query, limit) {
|
|
1207
|
+
return from(this.ensureConfigured().search.suggest(query, limit));
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Get available entity types for filtering
|
|
1211
|
+
*/ getEntityTypes() {
|
|
1212
|
+
return from(this.ensureConfigured().search.entityTypes());
|
|
1213
|
+
}
|
|
1214
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1215
|
+
// Search History
|
|
1216
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1217
|
+
/**
|
|
1218
|
+
* Get recent search queries
|
|
1219
|
+
*/ getLastQueries(limit) {
|
|
1220
|
+
return from(this.ensureConfigured().history.getLastQueries(limit));
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Get the full history of search queries
|
|
1224
|
+
*/ getQueryHistory(params) {
|
|
1225
|
+
return from(this.ensureConfigured().history.getHistory(params));
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Clear search history
|
|
1229
|
+
*/ clearHistory() {
|
|
1230
|
+
return from(this.ensureConfigured().history.clear());
|
|
1231
|
+
}
|
|
1232
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1233
|
+
// Favorites
|
|
1234
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1235
|
+
/**
|
|
1236
|
+
* List user's favorite entities
|
|
1237
|
+
*/ listFavorites() {
|
|
1238
|
+
return from(this.ensureConfigured().favorites.list());
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Add an entity to favorites
|
|
1242
|
+
*/ addFavorite(request) {
|
|
1243
|
+
return from(this.ensureConfigured().favorites.add(request));
|
|
1244
|
+
}
|
|
1245
|
+
/**
|
|
1246
|
+
* Remove an entity from favorites
|
|
1247
|
+
*/ removeFavorite(id) {
|
|
1248
|
+
return from(this.ensureConfigured().favorites.remove(id));
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Check if an entity is favorited
|
|
1252
|
+
*/ isFavorite(entityUniqueId) {
|
|
1253
|
+
return from(this.ensureConfigured().favorites.isFavorite(entityUniqueId));
|
|
1254
|
+
}
|
|
1255
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1256
|
+
// Direct Block Access (for advanced usage)
|
|
1257
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1258
|
+
/**
|
|
1259
|
+
* Access the underlying block for advanced operations
|
|
1260
|
+
*/ get rawBlock() {
|
|
1261
|
+
return this.ensureConfigured();
|
|
1262
|
+
}
|
|
1263
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
1264
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
1265
|
+
this.block = transport ? createSearchBlock(transport, config) : null;
|
|
1266
|
+
}
|
|
1267
|
+
}, _classThis = _class, (()=>{
|
|
1268
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1269
|
+
__esDecorate(null, _classDescriptor = {
|
|
1270
|
+
value: _classThis
|
|
1271
|
+
}, _classDecorators, {
|
|
1272
|
+
kind: "class",
|
|
1273
|
+
name: _classThis.name,
|
|
1274
|
+
metadata: _metadata
|
|
1275
|
+
}, null, _classExtraInitializers);
|
|
1276
|
+
_classThis = _classDescriptor.value;
|
|
1277
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
1278
|
+
enumerable: true,
|
|
1279
|
+
configurable: true,
|
|
1280
|
+
writable: true,
|
|
1281
|
+
value: _metadata
|
|
1282
|
+
});
|
|
1283
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1284
|
+
})(), _class);
|
|
1285
|
+
return _classThis;
|
|
1286
|
+
})();
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Angular service wrapping the Products block.
|
|
1290
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
1291
|
+
*
|
|
1292
|
+
* @example
|
|
1293
|
+
* ```typescript
|
|
1294
|
+
* @Component({...})
|
|
1295
|
+
* export class ProductsComponent {
|
|
1296
|
+
* constructor(private products: ProductsService) {}
|
|
1297
|
+
*
|
|
1298
|
+
* loadProducts() {
|
|
1299
|
+
* this.products.listProducts().subscribe({
|
|
1300
|
+
* next: (result) => console.log('Products:', result.data),
|
|
1301
|
+
* error: (err) => console.error('Failed:', err),
|
|
1302
|
+
* });
|
|
1303
|
+
* }
|
|
1304
|
+
* }
|
|
1305
|
+
* ```
|
|
1306
|
+
*/ let ProductsService = (()=>{
|
|
1307
|
+
var _class;
|
|
1308
|
+
let _classDecorators = [
|
|
1309
|
+
Injectable({
|
|
1310
|
+
providedIn: 'root'
|
|
1311
|
+
})
|
|
1312
|
+
];
|
|
1313
|
+
let _classDescriptor;
|
|
1314
|
+
let _classExtraInitializers = [];
|
|
1315
|
+
let _classThis;
|
|
1316
|
+
(_class = class {
|
|
1317
|
+
/**
|
|
1318
|
+
* Ensure the service is configured, throw helpful error if not
|
|
1319
|
+
*/ ensureConfigured() {
|
|
1320
|
+
if (!this.block) {
|
|
1321
|
+
throw new Error('[23blocks] ProductsService is not configured. ' + "Add 'urls.products' to your provideBlocks23() configuration.");
|
|
1322
|
+
}
|
|
1323
|
+
return this.block;
|
|
1324
|
+
}
|
|
1325
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1326
|
+
// Products Service
|
|
1327
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1328
|
+
listProducts(params) {
|
|
1329
|
+
return from(this.ensureConfigured().products.list(params));
|
|
1330
|
+
}
|
|
1331
|
+
getProduct(uniqueId) {
|
|
1332
|
+
return from(this.ensureConfigured().products.get(uniqueId));
|
|
1333
|
+
}
|
|
1334
|
+
createProduct(data) {
|
|
1335
|
+
return from(this.ensureConfigured().products.create(data));
|
|
1336
|
+
}
|
|
1337
|
+
updateProduct(uniqueId, data) {
|
|
1338
|
+
return from(this.ensureConfigured().products.update(uniqueId, data));
|
|
1339
|
+
}
|
|
1340
|
+
deleteProduct(uniqueId) {
|
|
1341
|
+
return from(this.ensureConfigured().products.delete(uniqueId));
|
|
1342
|
+
}
|
|
1343
|
+
recoverProduct(uniqueId) {
|
|
1344
|
+
return from(this.ensureConfigured().products.recover(uniqueId));
|
|
1345
|
+
}
|
|
1346
|
+
searchProducts(query, params) {
|
|
1347
|
+
return from(this.ensureConfigured().products.search(query, params));
|
|
1348
|
+
}
|
|
1349
|
+
listDeletedProducts(params) {
|
|
1350
|
+
return from(this.ensureConfigured().products.listDeleted(params));
|
|
1351
|
+
}
|
|
1352
|
+
// Variations
|
|
1353
|
+
listVariations(productUniqueId) {
|
|
1354
|
+
return from(this.ensureConfigured().products.listVariations(productUniqueId));
|
|
1355
|
+
}
|
|
1356
|
+
getVariation(uniqueId) {
|
|
1357
|
+
return from(this.ensureConfigured().products.getVariation(uniqueId));
|
|
1358
|
+
}
|
|
1359
|
+
createVariation(data) {
|
|
1360
|
+
return from(this.ensureConfigured().products.createVariation(data));
|
|
1361
|
+
}
|
|
1362
|
+
updateVariation(uniqueId, data) {
|
|
1363
|
+
return from(this.ensureConfigured().products.updateVariation(uniqueId, data));
|
|
1364
|
+
}
|
|
1365
|
+
deleteVariation(uniqueId) {
|
|
1366
|
+
return from(this.ensureConfigured().products.deleteVariation(uniqueId));
|
|
1367
|
+
}
|
|
1368
|
+
// Images
|
|
1369
|
+
listImages(productUniqueId) {
|
|
1370
|
+
return from(this.ensureConfigured().products.listImages(productUniqueId));
|
|
1371
|
+
}
|
|
1372
|
+
addImage(productUniqueId, imageUrl, isPrimary) {
|
|
1373
|
+
return from(this.ensureConfigured().products.addImage(productUniqueId, imageUrl, isPrimary));
|
|
1374
|
+
}
|
|
1375
|
+
deleteImage(uniqueId) {
|
|
1376
|
+
return from(this.ensureConfigured().products.deleteImage(uniqueId));
|
|
1377
|
+
}
|
|
1378
|
+
// Stock
|
|
1379
|
+
getStock(productUniqueId, vendorUniqueId) {
|
|
1380
|
+
return from(this.ensureConfigured().products.getStock(productUniqueId, vendorUniqueId));
|
|
1381
|
+
}
|
|
1382
|
+
updateStock(productUniqueId, vendorUniqueId, warehouseUniqueId, quantity) {
|
|
1383
|
+
return from(this.ensureConfigured().products.updateStock(productUniqueId, vendorUniqueId, warehouseUniqueId, quantity));
|
|
1384
|
+
}
|
|
1385
|
+
// Reviews
|
|
1386
|
+
listReviews(productUniqueId) {
|
|
1387
|
+
return from(this.ensureConfigured().products.listReviews(productUniqueId));
|
|
1388
|
+
}
|
|
1389
|
+
addReview(productUniqueId, rating, title, content) {
|
|
1390
|
+
return from(this.ensureConfigured().products.addReview(productUniqueId, rating, title, content));
|
|
1391
|
+
}
|
|
1392
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1393
|
+
// Cart Service
|
|
1394
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1395
|
+
getCart(userUniqueId) {
|
|
1396
|
+
return from(this.ensureConfigured().cart.get(userUniqueId));
|
|
1397
|
+
}
|
|
1398
|
+
getOrCreateCart(userUniqueId) {
|
|
1399
|
+
return from(this.ensureConfigured().cart.getOrCreate(userUniqueId));
|
|
1400
|
+
}
|
|
1401
|
+
updateCart(userUniqueId, data) {
|
|
1402
|
+
return from(this.ensureConfigured().cart.update(userUniqueId, data));
|
|
1403
|
+
}
|
|
1404
|
+
deleteCart(userUniqueId) {
|
|
1405
|
+
return from(this.ensureConfigured().cart.delete(userUniqueId));
|
|
1406
|
+
}
|
|
1407
|
+
// Cart Items
|
|
1408
|
+
addCartItem(userUniqueId, item) {
|
|
1409
|
+
return from(this.ensureConfigured().cart.addItem(userUniqueId, item));
|
|
1410
|
+
}
|
|
1411
|
+
updateCartItem(userUniqueId, productUniqueId, data) {
|
|
1412
|
+
return from(this.ensureConfigured().cart.updateItem(userUniqueId, productUniqueId, data));
|
|
1413
|
+
}
|
|
1414
|
+
removeCartItem(userUniqueId, productUniqueId) {
|
|
1415
|
+
return from(this.ensureConfigured().cart.removeItem(userUniqueId, productUniqueId));
|
|
1416
|
+
}
|
|
1417
|
+
getCartItems(userUniqueId) {
|
|
1418
|
+
return from(this.ensureConfigured().cart.getItems(userUniqueId));
|
|
1419
|
+
}
|
|
1420
|
+
// Checkout
|
|
1421
|
+
checkout(userUniqueId, data) {
|
|
1422
|
+
return from(this.ensureConfigured().cart.checkout(userUniqueId, data));
|
|
1423
|
+
}
|
|
1424
|
+
orderCart(userUniqueId) {
|
|
1425
|
+
return from(this.ensureConfigured().cart.order(userUniqueId));
|
|
1426
|
+
}
|
|
1427
|
+
orderCartItem(userUniqueId, productUniqueId) {
|
|
1428
|
+
return from(this.ensureConfigured().cart.orderItem(userUniqueId, productUniqueId));
|
|
1429
|
+
}
|
|
1430
|
+
cancelCart(userUniqueId) {
|
|
1431
|
+
return from(this.ensureConfigured().cart.cancel(userUniqueId));
|
|
1432
|
+
}
|
|
1433
|
+
cancelCartItem(userUniqueId, productUniqueId) {
|
|
1434
|
+
return from(this.ensureConfigured().cart.cancelItem(userUniqueId, productUniqueId));
|
|
1435
|
+
}
|
|
1436
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1437
|
+
// Categories Service
|
|
1438
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1439
|
+
listCategories(params) {
|
|
1440
|
+
return from(this.ensureConfigured().categories.list(params));
|
|
1441
|
+
}
|
|
1442
|
+
getCategory(uniqueId) {
|
|
1443
|
+
return from(this.ensureConfigured().categories.get(uniqueId));
|
|
1444
|
+
}
|
|
1445
|
+
createCategory(data) {
|
|
1446
|
+
return from(this.ensureConfigured().categories.create(data));
|
|
1447
|
+
}
|
|
1448
|
+
updateCategory(uniqueId, data) {
|
|
1449
|
+
return from(this.ensureConfigured().categories.update(uniqueId, data));
|
|
1450
|
+
}
|
|
1451
|
+
deleteCategory(uniqueId) {
|
|
1452
|
+
return from(this.ensureConfigured().categories.delete(uniqueId));
|
|
1453
|
+
}
|
|
1454
|
+
recoverCategory(uniqueId) {
|
|
1455
|
+
return from(this.ensureConfigured().categories.recover(uniqueId));
|
|
1456
|
+
}
|
|
1457
|
+
getCategoryChildren(uniqueId) {
|
|
1458
|
+
return from(this.ensureConfigured().categories.getChildren(uniqueId));
|
|
1459
|
+
}
|
|
1460
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1461
|
+
// Brands Service
|
|
1462
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1463
|
+
listBrands(page, perPage) {
|
|
1464
|
+
return from(this.ensureConfigured().brands.list(page, perPage));
|
|
1465
|
+
}
|
|
1466
|
+
getBrand(uniqueId) {
|
|
1467
|
+
return from(this.ensureConfigured().brands.get(uniqueId));
|
|
1468
|
+
}
|
|
1469
|
+
createBrand(data) {
|
|
1470
|
+
return from(this.ensureConfigured().brands.create(data));
|
|
1471
|
+
}
|
|
1472
|
+
updateBrand(uniqueId, data) {
|
|
1473
|
+
return from(this.ensureConfigured().brands.update(uniqueId, data));
|
|
1474
|
+
}
|
|
1475
|
+
deleteBrand(uniqueId) {
|
|
1476
|
+
return from(this.ensureConfigured().brands.delete(uniqueId));
|
|
1477
|
+
}
|
|
1478
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1479
|
+
// Vendors Service
|
|
1480
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1481
|
+
listVendors(params) {
|
|
1482
|
+
return from(this.ensureConfigured().vendors.list(params));
|
|
1483
|
+
}
|
|
1484
|
+
getVendor(uniqueId) {
|
|
1485
|
+
return from(this.ensureConfigured().vendors.get(uniqueId));
|
|
1486
|
+
}
|
|
1487
|
+
createVendor(data) {
|
|
1488
|
+
return from(this.ensureConfigured().vendors.create(data));
|
|
1489
|
+
}
|
|
1490
|
+
updateVendor(uniqueId, data) {
|
|
1491
|
+
return from(this.ensureConfigured().vendors.update(uniqueId, data));
|
|
1492
|
+
}
|
|
1493
|
+
deleteVendor(uniqueId) {
|
|
1494
|
+
return from(this.ensureConfigured().vendors.delete(uniqueId));
|
|
1495
|
+
}
|
|
1496
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1497
|
+
// Warehouses Service
|
|
1498
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1499
|
+
listWarehouses(params) {
|
|
1500
|
+
return from(this.ensureConfigured().warehouses.list(params));
|
|
1501
|
+
}
|
|
1502
|
+
getWarehouse(uniqueId) {
|
|
1503
|
+
return from(this.ensureConfigured().warehouses.get(uniqueId));
|
|
1504
|
+
}
|
|
1505
|
+
createWarehouse(data) {
|
|
1506
|
+
return from(this.ensureConfigured().warehouses.create(data));
|
|
1507
|
+
}
|
|
1508
|
+
updateWarehouse(uniqueId, data) {
|
|
1509
|
+
return from(this.ensureConfigured().warehouses.update(uniqueId, data));
|
|
1510
|
+
}
|
|
1511
|
+
deleteWarehouse(uniqueId) {
|
|
1512
|
+
return from(this.ensureConfigured().warehouses.delete(uniqueId));
|
|
1513
|
+
}
|
|
1514
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1515
|
+
// Channels Service
|
|
1516
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1517
|
+
listChannels() {
|
|
1518
|
+
return from(this.ensureConfigured().channels.list());
|
|
1519
|
+
}
|
|
1520
|
+
getChannel(uniqueId) {
|
|
1521
|
+
return from(this.ensureConfigured().channels.get(uniqueId));
|
|
1522
|
+
}
|
|
1523
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1524
|
+
// Collections Service
|
|
1525
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1526
|
+
listCollections() {
|
|
1527
|
+
return from(this.ensureConfigured().collections.list());
|
|
1528
|
+
}
|
|
1529
|
+
getCollection(uniqueId) {
|
|
1530
|
+
return from(this.ensureConfigured().collections.get(uniqueId));
|
|
1531
|
+
}
|
|
1532
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1533
|
+
// Direct Block Access (for advanced usage)
|
|
1534
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1535
|
+
/**
|
|
1536
|
+
* Access the underlying block for advanced operations
|
|
1537
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
1538
|
+
*/ get rawBlock() {
|
|
1539
|
+
return this.ensureConfigured();
|
|
1540
|
+
}
|
|
1541
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
1542
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
1543
|
+
this.block = transport ? createProductsBlock(transport, config) : null;
|
|
1544
|
+
}
|
|
1545
|
+
}, _classThis = _class, (()=>{
|
|
1546
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1547
|
+
__esDecorate(null, _classDescriptor = {
|
|
1548
|
+
value: _classThis
|
|
1549
|
+
}, _classDecorators, {
|
|
1550
|
+
kind: "class",
|
|
1551
|
+
name: _classThis.name,
|
|
1552
|
+
metadata: _metadata
|
|
1553
|
+
}, null, _classExtraInitializers);
|
|
1554
|
+
_classThis = _classDescriptor.value;
|
|
1555
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
1556
|
+
enumerable: true,
|
|
1557
|
+
configurable: true,
|
|
1558
|
+
writable: true,
|
|
1559
|
+
value: _metadata
|
|
1560
|
+
});
|
|
1561
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1562
|
+
})(), _class);
|
|
1563
|
+
return _classThis;
|
|
1564
|
+
})();
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Angular service wrapping the CRM block.
|
|
1568
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
1569
|
+
*
|
|
1570
|
+
* @example
|
|
1571
|
+
* ```typescript
|
|
1572
|
+
* @Component({...})
|
|
1573
|
+
* export class AccountsComponent {
|
|
1574
|
+
* constructor(private crm: CrmService) {}
|
|
1575
|
+
*
|
|
1576
|
+
* loadAccounts() {
|
|
1577
|
+
* this.crm.listAccounts({ page: 1, perPage: 20 }).subscribe({
|
|
1578
|
+
* next: (result) => console.log('Accounts:', result.data),
|
|
1579
|
+
* error: (err) => console.error('Failed:', err),
|
|
1580
|
+
* });
|
|
1581
|
+
* }
|
|
1582
|
+
* }
|
|
1583
|
+
* ```
|
|
1584
|
+
*/ let CrmService = (()=>{
|
|
1585
|
+
var _class;
|
|
1586
|
+
let _classDecorators = [
|
|
1587
|
+
Injectable({
|
|
1588
|
+
providedIn: 'root'
|
|
1589
|
+
})
|
|
1590
|
+
];
|
|
1591
|
+
let _classDescriptor;
|
|
1592
|
+
let _classExtraInitializers = [];
|
|
1593
|
+
let _classThis;
|
|
1594
|
+
(_class = class {
|
|
1595
|
+
/**
|
|
1596
|
+
* Ensure the service is configured, throw helpful error if not
|
|
1597
|
+
*/ ensureConfigured() {
|
|
1598
|
+
if (!this.block) {
|
|
1599
|
+
throw new Error('[23blocks] CrmService is not configured. ' + "Add 'urls.crm' to your provideBlocks23() configuration.");
|
|
1600
|
+
}
|
|
1601
|
+
return this.block;
|
|
1602
|
+
}
|
|
1603
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1604
|
+
// Accounts Service
|
|
1605
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1606
|
+
listAccounts(params) {
|
|
1607
|
+
return from(this.ensureConfigured().accounts.list(params));
|
|
1608
|
+
}
|
|
1609
|
+
getAccount(uniqueId) {
|
|
1610
|
+
return from(this.ensureConfigured().accounts.get(uniqueId));
|
|
1611
|
+
}
|
|
1612
|
+
createAccount(data) {
|
|
1613
|
+
return from(this.ensureConfigured().accounts.create(data));
|
|
1614
|
+
}
|
|
1615
|
+
updateAccount(uniqueId, data) {
|
|
1616
|
+
return from(this.ensureConfigured().accounts.update(uniqueId, data));
|
|
1617
|
+
}
|
|
1618
|
+
deleteAccount(uniqueId) {
|
|
1619
|
+
return from(this.ensureConfigured().accounts.delete(uniqueId));
|
|
1620
|
+
}
|
|
1621
|
+
recoverAccount(uniqueId) {
|
|
1622
|
+
return from(this.ensureConfigured().accounts.recover(uniqueId));
|
|
1623
|
+
}
|
|
1624
|
+
searchAccounts(query, params) {
|
|
1625
|
+
return from(this.ensureConfigured().accounts.search(query, params));
|
|
1626
|
+
}
|
|
1627
|
+
listDeletedAccounts(params) {
|
|
1628
|
+
return from(this.ensureConfigured().accounts.listDeleted(params));
|
|
1629
|
+
}
|
|
1630
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1631
|
+
// Contacts Service
|
|
1632
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1633
|
+
listContacts(params) {
|
|
1634
|
+
return from(this.ensureConfigured().contacts.list(params));
|
|
1635
|
+
}
|
|
1636
|
+
getContact(uniqueId) {
|
|
1637
|
+
return from(this.ensureConfigured().contacts.get(uniqueId));
|
|
1638
|
+
}
|
|
1639
|
+
createContact(data) {
|
|
1640
|
+
return from(this.ensureConfigured().contacts.create(data));
|
|
1641
|
+
}
|
|
1642
|
+
updateContact(uniqueId, data) {
|
|
1643
|
+
return from(this.ensureConfigured().contacts.update(uniqueId, data));
|
|
1644
|
+
}
|
|
1645
|
+
deleteContact(uniqueId) {
|
|
1646
|
+
return from(this.ensureConfigured().contacts.delete(uniqueId));
|
|
1647
|
+
}
|
|
1648
|
+
recoverContact(uniqueId) {
|
|
1649
|
+
return from(this.ensureConfigured().contacts.recover(uniqueId));
|
|
1650
|
+
}
|
|
1651
|
+
searchContacts(query, params) {
|
|
1652
|
+
return from(this.ensureConfigured().contacts.search(query, params));
|
|
1653
|
+
}
|
|
1654
|
+
listDeletedContacts(params) {
|
|
1655
|
+
return from(this.ensureConfigured().contacts.listDeleted(params));
|
|
1656
|
+
}
|
|
1657
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1658
|
+
// Leads Service
|
|
1659
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1660
|
+
listLeads(params) {
|
|
1661
|
+
return from(this.ensureConfigured().leads.list(params));
|
|
1662
|
+
}
|
|
1663
|
+
getLead(uniqueId) {
|
|
1664
|
+
return from(this.ensureConfigured().leads.get(uniqueId));
|
|
1665
|
+
}
|
|
1666
|
+
createLead(data) {
|
|
1667
|
+
return from(this.ensureConfigured().leads.create(data));
|
|
1668
|
+
}
|
|
1669
|
+
updateLead(uniqueId, data) {
|
|
1670
|
+
return from(this.ensureConfigured().leads.update(uniqueId, data));
|
|
1671
|
+
}
|
|
1672
|
+
deleteLead(uniqueId) {
|
|
1673
|
+
return from(this.ensureConfigured().leads.delete(uniqueId));
|
|
1674
|
+
}
|
|
1675
|
+
recoverLead(uniqueId) {
|
|
1676
|
+
return from(this.ensureConfigured().leads.recover(uniqueId));
|
|
1677
|
+
}
|
|
1678
|
+
searchLeads(query, params) {
|
|
1679
|
+
return from(this.ensureConfigured().leads.search(query, params));
|
|
1680
|
+
}
|
|
1681
|
+
listDeletedLeads(params) {
|
|
1682
|
+
return from(this.ensureConfigured().leads.listDeleted(params));
|
|
1683
|
+
}
|
|
1684
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1685
|
+
// Opportunities Service
|
|
1686
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1687
|
+
listOpportunities(params) {
|
|
1688
|
+
return from(this.ensureConfigured().opportunities.list(params));
|
|
1689
|
+
}
|
|
1690
|
+
getOpportunity(uniqueId) {
|
|
1691
|
+
return from(this.ensureConfigured().opportunities.get(uniqueId));
|
|
1692
|
+
}
|
|
1693
|
+
createOpportunity(data) {
|
|
1694
|
+
return from(this.ensureConfigured().opportunities.create(data));
|
|
1695
|
+
}
|
|
1696
|
+
updateOpportunity(uniqueId, data) {
|
|
1697
|
+
return from(this.ensureConfigured().opportunities.update(uniqueId, data));
|
|
1698
|
+
}
|
|
1699
|
+
deleteOpportunity(uniqueId) {
|
|
1700
|
+
return from(this.ensureConfigured().opportunities.delete(uniqueId));
|
|
1701
|
+
}
|
|
1702
|
+
recoverOpportunity(uniqueId) {
|
|
1703
|
+
return from(this.ensureConfigured().opportunities.recover(uniqueId));
|
|
1704
|
+
}
|
|
1705
|
+
searchOpportunities(query, params) {
|
|
1706
|
+
return from(this.ensureConfigured().opportunities.search(query, params));
|
|
1707
|
+
}
|
|
1708
|
+
listDeletedOpportunities(params) {
|
|
1709
|
+
return from(this.ensureConfigured().opportunities.listDeleted(params));
|
|
1710
|
+
}
|
|
1711
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1712
|
+
// Meetings Service
|
|
1713
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1714
|
+
listMeetings(params) {
|
|
1715
|
+
return from(this.ensureConfigured().meetings.list(params));
|
|
1716
|
+
}
|
|
1717
|
+
getMeeting(uniqueId) {
|
|
1718
|
+
return from(this.ensureConfigured().meetings.get(uniqueId));
|
|
1719
|
+
}
|
|
1720
|
+
createMeeting(data) {
|
|
1721
|
+
return from(this.ensureConfigured().meetings.create(data));
|
|
1722
|
+
}
|
|
1723
|
+
updateMeeting(uniqueId, data) {
|
|
1724
|
+
return from(this.ensureConfigured().meetings.update(uniqueId, data));
|
|
1725
|
+
}
|
|
1726
|
+
deleteMeeting(uniqueId) {
|
|
1727
|
+
return from(this.ensureConfigured().meetings.delete(uniqueId));
|
|
1728
|
+
}
|
|
1729
|
+
recoverMeeting(uniqueId) {
|
|
1730
|
+
return from(this.ensureConfigured().meetings.recover(uniqueId));
|
|
1731
|
+
}
|
|
1732
|
+
searchMeetings(query, params) {
|
|
1733
|
+
return from(this.ensureConfigured().meetings.search(query, params));
|
|
1734
|
+
}
|
|
1735
|
+
listDeletedMeetings(params) {
|
|
1736
|
+
return from(this.ensureConfigured().meetings.listDeleted(params));
|
|
1737
|
+
}
|
|
1738
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1739
|
+
// Quotes Service
|
|
1740
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1741
|
+
listQuotes(params) {
|
|
1742
|
+
return from(this.ensureConfigured().quotes.list(params));
|
|
1743
|
+
}
|
|
1744
|
+
getQuote(uniqueId) {
|
|
1745
|
+
return from(this.ensureConfigured().quotes.get(uniqueId));
|
|
1746
|
+
}
|
|
1747
|
+
createQuote(data) {
|
|
1748
|
+
return from(this.ensureConfigured().quotes.create(data));
|
|
1749
|
+
}
|
|
1750
|
+
updateQuote(uniqueId, data) {
|
|
1751
|
+
return from(this.ensureConfigured().quotes.update(uniqueId, data));
|
|
1752
|
+
}
|
|
1753
|
+
deleteQuote(uniqueId) {
|
|
1754
|
+
return from(this.ensureConfigured().quotes.delete(uniqueId));
|
|
1755
|
+
}
|
|
1756
|
+
recoverQuote(uniqueId) {
|
|
1757
|
+
return from(this.ensureConfigured().quotes.recover(uniqueId));
|
|
1758
|
+
}
|
|
1759
|
+
searchQuotes(query, params) {
|
|
1760
|
+
return from(this.ensureConfigured().quotes.search(query, params));
|
|
1761
|
+
}
|
|
1762
|
+
listDeletedQuotes(params) {
|
|
1763
|
+
return from(this.ensureConfigured().quotes.listDeleted(params));
|
|
1764
|
+
}
|
|
1765
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1766
|
+
// Direct Block Access (for advanced usage)
|
|
1767
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
1768
|
+
/**
|
|
1769
|
+
* Access the underlying block for advanced operations
|
|
1770
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
1771
|
+
*/ get rawBlock() {
|
|
1772
|
+
return this.ensureConfigured();
|
|
1773
|
+
}
|
|
1774
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
1775
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
1776
|
+
this.block = transport ? createCrmBlock(transport, config) : null;
|
|
1777
|
+
}
|
|
1778
|
+
}, _classThis = _class, (()=>{
|
|
1779
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1780
|
+
__esDecorate(null, _classDescriptor = {
|
|
1781
|
+
value: _classThis
|
|
1782
|
+
}, _classDecorators, {
|
|
1783
|
+
kind: "class",
|
|
1784
|
+
name: _classThis.name,
|
|
1785
|
+
metadata: _metadata
|
|
1786
|
+
}, null, _classExtraInitializers);
|
|
1787
|
+
_classThis = _classDescriptor.value;
|
|
1788
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
1789
|
+
enumerable: true,
|
|
1790
|
+
configurable: true,
|
|
1791
|
+
writable: true,
|
|
1792
|
+
value: _metadata
|
|
1793
|
+
});
|
|
1794
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1795
|
+
})(), _class);
|
|
1796
|
+
return _classThis;
|
|
1797
|
+
})();
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* Angular service wrapping the Content block.
|
|
1801
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* ```typescript
|
|
1805
|
+
* @Component({...})
|
|
1806
|
+
* export class BlogComponent {
|
|
1807
|
+
* constructor(private content: ContentService) {}
|
|
1808
|
+
*
|
|
1809
|
+
* loadPosts() {
|
|
1810
|
+
* this.content.listPosts({ page: 1, perPage: 10 }).subscribe({
|
|
1811
|
+
* next: (result) => console.log('Posts:', result.data),
|
|
1812
|
+
* error: (err) => console.error('Failed:', err),
|
|
1813
|
+
* });
|
|
1814
|
+
* }
|
|
1815
|
+
* }
|
|
1816
|
+
* ```
|
|
1817
|
+
*/ let ContentService = (()=>{
|
|
1818
|
+
var _class;
|
|
1819
|
+
let _classDecorators = [
|
|
1820
|
+
Injectable({
|
|
1821
|
+
providedIn: 'root'
|
|
1822
|
+
})
|
|
1823
|
+
];
|
|
1824
|
+
let _classDescriptor;
|
|
1825
|
+
let _classExtraInitializers = [];
|
|
1826
|
+
let _classThis;
|
|
1827
|
+
(_class = class {
|
|
1828
|
+
/**
|
|
1829
|
+
* Ensure the service is configured, throw helpful error if not
|
|
1830
|
+
*/ ensureConfigured() {
|
|
1831
|
+
if (!this.block) {
|
|
1832
|
+
throw new Error('[23blocks] ContentService is not configured. ' + "Add 'urls.content' to your provideBlocks23() configuration.");
|
|
1833
|
+
}
|
|
1834
|
+
return this.block;
|
|
1835
|
+
}
|
|
1836
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1837
|
+
// Posts Service
|
|
1838
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1839
|
+
listPosts(params) {
|
|
1840
|
+
return from(this.ensureConfigured().posts.list(params));
|
|
1841
|
+
}
|
|
1842
|
+
getPost(uniqueId) {
|
|
1843
|
+
return from(this.ensureConfigured().posts.get(uniqueId));
|
|
1844
|
+
}
|
|
1845
|
+
createPost(data) {
|
|
1846
|
+
return from(this.ensureConfigured().posts.create(data));
|
|
1847
|
+
}
|
|
1848
|
+
updatePost(uniqueId, data) {
|
|
1849
|
+
return from(this.ensureConfigured().posts.update(uniqueId, data));
|
|
1850
|
+
}
|
|
1851
|
+
deletePost(uniqueId) {
|
|
1852
|
+
return from(this.ensureConfigured().posts.delete(uniqueId));
|
|
1853
|
+
}
|
|
1854
|
+
recoverPost(uniqueId) {
|
|
1855
|
+
return from(this.ensureConfigured().posts.recover(uniqueId));
|
|
1856
|
+
}
|
|
1857
|
+
searchPosts(query, params) {
|
|
1858
|
+
return from(this.ensureConfigured().posts.search(query, params));
|
|
1859
|
+
}
|
|
1860
|
+
listDeletedPosts(params) {
|
|
1861
|
+
return from(this.ensureConfigured().posts.listDeleted(params));
|
|
1862
|
+
}
|
|
1863
|
+
likePost(uniqueId) {
|
|
1864
|
+
return from(this.ensureConfigured().posts.like(uniqueId));
|
|
1865
|
+
}
|
|
1866
|
+
dislikePost(uniqueId) {
|
|
1867
|
+
return from(this.ensureConfigured().posts.dislike(uniqueId));
|
|
1868
|
+
}
|
|
1869
|
+
savePost(uniqueId) {
|
|
1870
|
+
return from(this.ensureConfigured().posts.save(uniqueId));
|
|
1871
|
+
}
|
|
1872
|
+
followPost(uniqueId) {
|
|
1873
|
+
return from(this.ensureConfigured().posts.follow(uniqueId));
|
|
1874
|
+
}
|
|
1875
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1876
|
+
// Comments Service
|
|
1877
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1878
|
+
listComments(params) {
|
|
1879
|
+
return from(this.ensureConfigured().comments.list(params));
|
|
1880
|
+
}
|
|
1881
|
+
getComment(uniqueId) {
|
|
1882
|
+
return from(this.ensureConfigured().comments.get(uniqueId));
|
|
1883
|
+
}
|
|
1884
|
+
createComment(data) {
|
|
1885
|
+
return from(this.ensureConfigured().comments.create(data));
|
|
1886
|
+
}
|
|
1887
|
+
updateComment(uniqueId, data) {
|
|
1888
|
+
return from(this.ensureConfigured().comments.update(uniqueId, data));
|
|
1889
|
+
}
|
|
1890
|
+
deleteComment(uniqueId) {
|
|
1891
|
+
return from(this.ensureConfigured().comments.delete(uniqueId));
|
|
1892
|
+
}
|
|
1893
|
+
likeComment(uniqueId) {
|
|
1894
|
+
return from(this.ensureConfigured().comments.like(uniqueId));
|
|
1895
|
+
}
|
|
1896
|
+
dislikeComment(uniqueId) {
|
|
1897
|
+
return from(this.ensureConfigured().comments.dislike(uniqueId));
|
|
1898
|
+
}
|
|
1899
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1900
|
+
// Categories Service
|
|
1901
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1902
|
+
listCategories(params) {
|
|
1903
|
+
return from(this.ensureConfigured().categories.list(params));
|
|
1904
|
+
}
|
|
1905
|
+
getCategory(uniqueId) {
|
|
1906
|
+
return from(this.ensureConfigured().categories.get(uniqueId));
|
|
1907
|
+
}
|
|
1908
|
+
createCategory(data) {
|
|
1909
|
+
return from(this.ensureConfigured().categories.create(data));
|
|
1910
|
+
}
|
|
1911
|
+
updateCategory(uniqueId, data) {
|
|
1912
|
+
return from(this.ensureConfigured().categories.update(uniqueId, data));
|
|
1913
|
+
}
|
|
1914
|
+
deleteCategory(uniqueId) {
|
|
1915
|
+
return from(this.ensureConfigured().categories.delete(uniqueId));
|
|
1916
|
+
}
|
|
1917
|
+
recoverCategory(uniqueId) {
|
|
1918
|
+
return from(this.ensureConfigured().categories.recover(uniqueId));
|
|
1919
|
+
}
|
|
1920
|
+
getCategoryChildren(uniqueId) {
|
|
1921
|
+
return from(this.ensureConfigured().categories.getChildren(uniqueId));
|
|
1922
|
+
}
|
|
1923
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1924
|
+
// Tags Service
|
|
1925
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1926
|
+
listTags(params) {
|
|
1927
|
+
return from(this.ensureConfigured().tags.list(params));
|
|
1928
|
+
}
|
|
1929
|
+
getTag(uniqueId) {
|
|
1930
|
+
return from(this.ensureConfigured().tags.get(uniqueId));
|
|
1931
|
+
}
|
|
1932
|
+
createTag(data) {
|
|
1933
|
+
return from(this.ensureConfigured().tags.create(data));
|
|
1934
|
+
}
|
|
1935
|
+
updateTag(uniqueId, data) {
|
|
1936
|
+
return from(this.ensureConfigured().tags.update(uniqueId, data));
|
|
1937
|
+
}
|
|
1938
|
+
deleteTag(uniqueId) {
|
|
1939
|
+
return from(this.ensureConfigured().tags.delete(uniqueId));
|
|
1940
|
+
}
|
|
1941
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1942
|
+
// Direct Block Access (for advanced usage)
|
|
1943
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
1944
|
+
/**
|
|
1945
|
+
* Access the underlying block for advanced operations
|
|
1946
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
1947
|
+
*/ get rawBlock() {
|
|
1948
|
+
return this.ensureConfigured();
|
|
1949
|
+
}
|
|
1950
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
1951
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
1952
|
+
this.block = transport ? createContentBlock(transport, config) : null;
|
|
1953
|
+
}
|
|
1954
|
+
}, _classThis = _class, (()=>{
|
|
1955
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
1956
|
+
__esDecorate(null, _classDescriptor = {
|
|
1957
|
+
value: _classThis
|
|
1958
|
+
}, _classDecorators, {
|
|
1959
|
+
kind: "class",
|
|
1960
|
+
name: _classThis.name,
|
|
1961
|
+
metadata: _metadata
|
|
1962
|
+
}, null, _classExtraInitializers);
|
|
1963
|
+
_classThis = _classDescriptor.value;
|
|
1964
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
1965
|
+
enumerable: true,
|
|
1966
|
+
configurable: true,
|
|
1967
|
+
writable: true,
|
|
1968
|
+
value: _metadata
|
|
1969
|
+
});
|
|
1970
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
1971
|
+
})(), _class);
|
|
1972
|
+
return _classThis;
|
|
1973
|
+
})();
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Angular service wrapping the Geolocation block.
|
|
1977
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
1978
|
+
*
|
|
1979
|
+
* @example
|
|
1980
|
+
* ```typescript
|
|
1981
|
+
* @Component({...})
|
|
1982
|
+
* export class MapComponent {
|
|
1983
|
+
* constructor(private geolocation: GeolocationService) {}
|
|
1984
|
+
*
|
|
1985
|
+
* loadLocations() {
|
|
1986
|
+
* this.geolocation.listLocations().subscribe({
|
|
1987
|
+
* next: (result) => console.log('Locations:', result.data),
|
|
1988
|
+
* error: (err) => console.error('Failed:', err),
|
|
1989
|
+
* });
|
|
1990
|
+
* }
|
|
1991
|
+
* }
|
|
1992
|
+
* ```
|
|
1993
|
+
*/ let GeolocationService = (()=>{
|
|
1994
|
+
var _class;
|
|
1995
|
+
let _classDecorators = [
|
|
1996
|
+
Injectable({
|
|
1997
|
+
providedIn: 'root'
|
|
1998
|
+
})
|
|
1999
|
+
];
|
|
2000
|
+
let _classDescriptor;
|
|
2001
|
+
let _classExtraInitializers = [];
|
|
2002
|
+
let _classThis;
|
|
2003
|
+
(_class = class {
|
|
2004
|
+
/**
|
|
2005
|
+
* Ensure the service is configured, throw helpful error if not
|
|
2006
|
+
*/ ensureConfigured() {
|
|
2007
|
+
if (!this.block) {
|
|
2008
|
+
throw new Error('[23blocks] GeolocationService is not configured. ' + "Add 'urls.geolocation' to your provideBlocks23() configuration.");
|
|
2009
|
+
}
|
|
2010
|
+
return this.block;
|
|
2011
|
+
}
|
|
2012
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2013
|
+
// Locations Service
|
|
2014
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2015
|
+
listLocations(params) {
|
|
2016
|
+
return from(this.ensureConfigured().locations.list(params));
|
|
2017
|
+
}
|
|
2018
|
+
getLocation(uniqueId) {
|
|
2019
|
+
return from(this.ensureConfigured().locations.get(uniqueId));
|
|
2020
|
+
}
|
|
2021
|
+
createLocation(data) {
|
|
2022
|
+
return from(this.ensureConfigured().locations.create(data));
|
|
2023
|
+
}
|
|
2024
|
+
updateLocation(uniqueId, data) {
|
|
2025
|
+
return from(this.ensureConfigured().locations.update(uniqueId, data));
|
|
2026
|
+
}
|
|
2027
|
+
deleteLocation(uniqueId) {
|
|
2028
|
+
return from(this.ensureConfigured().locations.delete(uniqueId));
|
|
2029
|
+
}
|
|
2030
|
+
recoverLocation(uniqueId) {
|
|
2031
|
+
return from(this.ensureConfigured().locations.recover(uniqueId));
|
|
2032
|
+
}
|
|
2033
|
+
searchLocations(query, params) {
|
|
2034
|
+
return from(this.ensureConfigured().locations.search(query, params));
|
|
2035
|
+
}
|
|
2036
|
+
listDeletedLocations(params) {
|
|
2037
|
+
return from(this.ensureConfigured().locations.listDeleted(params));
|
|
2038
|
+
}
|
|
2039
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2040
|
+
// Addresses Service
|
|
2041
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2042
|
+
listAddresses(params) {
|
|
2043
|
+
return from(this.ensureConfigured().addresses.list(params));
|
|
2044
|
+
}
|
|
2045
|
+
getAddress(uniqueId) {
|
|
2046
|
+
return from(this.ensureConfigured().addresses.get(uniqueId));
|
|
2047
|
+
}
|
|
2048
|
+
createAddress(data) {
|
|
2049
|
+
return from(this.ensureConfigured().addresses.create(data));
|
|
2050
|
+
}
|
|
2051
|
+
updateAddress(uniqueId, data) {
|
|
2052
|
+
return from(this.ensureConfigured().addresses.update(uniqueId, data));
|
|
2053
|
+
}
|
|
2054
|
+
deleteAddress(uniqueId) {
|
|
2055
|
+
return from(this.ensureConfigured().addresses.delete(uniqueId));
|
|
2056
|
+
}
|
|
2057
|
+
recoverAddress(uniqueId) {
|
|
2058
|
+
return from(this.ensureConfigured().addresses.recover(uniqueId));
|
|
2059
|
+
}
|
|
2060
|
+
searchAddresses(query, params) {
|
|
2061
|
+
return from(this.ensureConfigured().addresses.search(query, params));
|
|
2062
|
+
}
|
|
2063
|
+
listDeletedAddresses(params) {
|
|
2064
|
+
return from(this.ensureConfigured().addresses.listDeleted(params));
|
|
2065
|
+
}
|
|
2066
|
+
setDefaultAddress(uniqueId) {
|
|
2067
|
+
return from(this.ensureConfigured().addresses.setDefault(uniqueId));
|
|
2068
|
+
}
|
|
2069
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2070
|
+
// Areas Service
|
|
2071
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2072
|
+
listAreas(params) {
|
|
2073
|
+
return from(this.ensureConfigured().areas.list(params));
|
|
2074
|
+
}
|
|
2075
|
+
getArea(uniqueId) {
|
|
2076
|
+
return from(this.ensureConfigured().areas.get(uniqueId));
|
|
2077
|
+
}
|
|
2078
|
+
createArea(data) {
|
|
2079
|
+
return from(this.ensureConfigured().areas.create(data));
|
|
2080
|
+
}
|
|
2081
|
+
updateArea(uniqueId, data) {
|
|
2082
|
+
return from(this.ensureConfigured().areas.update(uniqueId, data));
|
|
2083
|
+
}
|
|
2084
|
+
deleteArea(uniqueId) {
|
|
2085
|
+
return from(this.ensureConfigured().areas.delete(uniqueId));
|
|
2086
|
+
}
|
|
2087
|
+
recoverArea(uniqueId) {
|
|
2088
|
+
return from(this.ensureConfigured().areas.recover(uniqueId));
|
|
2089
|
+
}
|
|
2090
|
+
searchAreas(query, params) {
|
|
2091
|
+
return from(this.ensureConfigured().areas.search(query, params));
|
|
2092
|
+
}
|
|
2093
|
+
listDeletedAreas(params) {
|
|
2094
|
+
return from(this.ensureConfigured().areas.listDeleted(params));
|
|
2095
|
+
}
|
|
2096
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2097
|
+
// Regions Service
|
|
2098
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2099
|
+
listRegions(params) {
|
|
2100
|
+
return from(this.ensureConfigured().regions.list(params));
|
|
2101
|
+
}
|
|
2102
|
+
getRegion(uniqueId) {
|
|
2103
|
+
return from(this.ensureConfigured().regions.get(uniqueId));
|
|
2104
|
+
}
|
|
2105
|
+
createRegion(data) {
|
|
2106
|
+
return from(this.ensureConfigured().regions.create(data));
|
|
2107
|
+
}
|
|
2108
|
+
updateRegion(uniqueId, data) {
|
|
2109
|
+
return from(this.ensureConfigured().regions.update(uniqueId, data));
|
|
2110
|
+
}
|
|
2111
|
+
deleteRegion(uniqueId) {
|
|
2112
|
+
return from(this.ensureConfigured().regions.delete(uniqueId));
|
|
2113
|
+
}
|
|
2114
|
+
recoverRegion(uniqueId) {
|
|
2115
|
+
return from(this.ensureConfigured().regions.recover(uniqueId));
|
|
2116
|
+
}
|
|
2117
|
+
searchRegions(query, params) {
|
|
2118
|
+
return from(this.ensureConfigured().regions.search(query, params));
|
|
2119
|
+
}
|
|
2120
|
+
listDeletedRegions(params) {
|
|
2121
|
+
return from(this.ensureConfigured().regions.listDeleted(params));
|
|
2122
|
+
}
|
|
2123
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2124
|
+
// Travel Routes Service
|
|
2125
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2126
|
+
listRoutes(params) {
|
|
2127
|
+
return from(this.ensureConfigured().routes.list(params));
|
|
2128
|
+
}
|
|
2129
|
+
getRoute(uniqueId) {
|
|
2130
|
+
return from(this.ensureConfigured().routes.get(uniqueId));
|
|
2131
|
+
}
|
|
2132
|
+
createRoute(data) {
|
|
2133
|
+
return from(this.ensureConfigured().routes.create(data));
|
|
2134
|
+
}
|
|
2135
|
+
updateRoute(uniqueId, data) {
|
|
2136
|
+
return from(this.ensureConfigured().routes.update(uniqueId, data));
|
|
2137
|
+
}
|
|
2138
|
+
deleteRoute(uniqueId) {
|
|
2139
|
+
return from(this.ensureConfigured().routes.delete(uniqueId));
|
|
2140
|
+
}
|
|
2141
|
+
recoverRoute(uniqueId) {
|
|
2142
|
+
return from(this.ensureConfigured().routes.recover(uniqueId));
|
|
2143
|
+
}
|
|
2144
|
+
searchRoutes(query, params) {
|
|
2145
|
+
return from(this.ensureConfigured().routes.search(query, params));
|
|
2146
|
+
}
|
|
2147
|
+
listDeletedRoutes(params) {
|
|
2148
|
+
return from(this.ensureConfigured().routes.listDeleted(params));
|
|
2149
|
+
}
|
|
2150
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2151
|
+
// Premise Bookings Service
|
|
2152
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2153
|
+
listBookings(params) {
|
|
2154
|
+
return from(this.ensureConfigured().bookings.list(params));
|
|
2155
|
+
}
|
|
2156
|
+
getBooking(uniqueId) {
|
|
2157
|
+
return from(this.ensureConfigured().bookings.get(uniqueId));
|
|
2158
|
+
}
|
|
2159
|
+
createBooking(data) {
|
|
2160
|
+
return from(this.ensureConfigured().bookings.create(data));
|
|
2161
|
+
}
|
|
2162
|
+
updateBooking(uniqueId, data) {
|
|
2163
|
+
return from(this.ensureConfigured().bookings.update(uniqueId, data));
|
|
2164
|
+
}
|
|
2165
|
+
deleteBooking(uniqueId) {
|
|
2166
|
+
return from(this.ensureConfigured().bookings.delete(uniqueId));
|
|
2167
|
+
}
|
|
2168
|
+
recoverBooking(uniqueId) {
|
|
2169
|
+
return from(this.ensureConfigured().bookings.recover(uniqueId));
|
|
2170
|
+
}
|
|
2171
|
+
searchBookings(query, params) {
|
|
2172
|
+
return from(this.ensureConfigured().bookings.search(query, params));
|
|
2173
|
+
}
|
|
2174
|
+
listDeletedBookings(params) {
|
|
2175
|
+
return from(this.ensureConfigured().bookings.listDeleted(params));
|
|
2176
|
+
}
|
|
2177
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2178
|
+
// Premises Service
|
|
2179
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2180
|
+
listPremises(params) {
|
|
2181
|
+
return from(this.ensureConfigured().premises.list(params));
|
|
2182
|
+
}
|
|
2183
|
+
getPremise(uniqueId) {
|
|
2184
|
+
return from(this.ensureConfigured().premises.get(uniqueId));
|
|
2185
|
+
}
|
|
2186
|
+
createPremise(data) {
|
|
2187
|
+
return from(this.ensureConfigured().premises.create(data));
|
|
2188
|
+
}
|
|
2189
|
+
updatePremise(uniqueId, data) {
|
|
2190
|
+
return from(this.ensureConfigured().premises.update(uniqueId, data));
|
|
2191
|
+
}
|
|
2192
|
+
deletePremise(uniqueId) {
|
|
2193
|
+
return from(this.ensureConfigured().premises.delete(uniqueId));
|
|
2194
|
+
}
|
|
2195
|
+
recoverPremise(uniqueId) {
|
|
2196
|
+
return from(this.ensureConfigured().premises.recover(uniqueId));
|
|
2197
|
+
}
|
|
2198
|
+
searchPremises(query, params) {
|
|
2199
|
+
return from(this.ensureConfigured().premises.search(query, params));
|
|
2200
|
+
}
|
|
2201
|
+
listDeletedPremises(params) {
|
|
2202
|
+
return from(this.ensureConfigured().premises.listDeleted(params));
|
|
2203
|
+
}
|
|
2204
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2205
|
+
// Direct Block Access (for advanced usage)
|
|
2206
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2207
|
+
/**
|
|
2208
|
+
* Access the underlying block for advanced operations
|
|
2209
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
2210
|
+
*/ get rawBlock() {
|
|
2211
|
+
return this.ensureConfigured();
|
|
2212
|
+
}
|
|
2213
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
2214
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
2215
|
+
this.block = transport ? createGeolocationBlock(transport, config) : null;
|
|
2216
|
+
}
|
|
2217
|
+
}, _classThis = _class, (()=>{
|
|
2218
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2219
|
+
__esDecorate(null, _classDescriptor = {
|
|
2220
|
+
value: _classThis
|
|
2221
|
+
}, _classDecorators, {
|
|
2222
|
+
kind: "class",
|
|
2223
|
+
name: _classThis.name,
|
|
2224
|
+
metadata: _metadata
|
|
2225
|
+
}, null, _classExtraInitializers);
|
|
2226
|
+
_classThis = _classDescriptor.value;
|
|
2227
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
2228
|
+
enumerable: true,
|
|
2229
|
+
configurable: true,
|
|
2230
|
+
writable: true,
|
|
2231
|
+
value: _metadata
|
|
2232
|
+
});
|
|
2233
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2234
|
+
})(), _class);
|
|
2235
|
+
return _classThis;
|
|
2236
|
+
})();
|
|
2237
|
+
|
|
2238
|
+
/**
|
|
2239
|
+
* Angular service wrapping the Conversations block.
|
|
2240
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
2241
|
+
*
|
|
2242
|
+
* @example
|
|
2243
|
+
* ```typescript
|
|
2244
|
+
* @Component({...})
|
|
2245
|
+
* export class ChatComponent {
|
|
2246
|
+
* constructor(private conversations: ConversationsService) {}
|
|
2247
|
+
*
|
|
2248
|
+
* sendMessage(contextId: string, content: string) {
|
|
2249
|
+
* this.conversations.createMessage({ contextId, content }).subscribe({
|
|
2250
|
+
* next: (message) => console.log('Message sent:', message),
|
|
2251
|
+
* error: (err) => console.error('Failed:', err),
|
|
2252
|
+
* });
|
|
2253
|
+
* }
|
|
2254
|
+
* }
|
|
2255
|
+
* ```
|
|
2256
|
+
*/ let ConversationsService = (()=>{
|
|
2257
|
+
var _class;
|
|
2258
|
+
let _classDecorators = [
|
|
2259
|
+
Injectable({
|
|
2260
|
+
providedIn: 'root'
|
|
2261
|
+
})
|
|
2262
|
+
];
|
|
2263
|
+
let _classDescriptor;
|
|
2264
|
+
let _classExtraInitializers = [];
|
|
2265
|
+
let _classThis;
|
|
2266
|
+
(_class = class {
|
|
2267
|
+
/**
|
|
2268
|
+
* Ensure the service is configured, throw helpful error if not
|
|
2269
|
+
*/ ensureConfigured() {
|
|
2270
|
+
if (!this.block) {
|
|
2271
|
+
throw new Error('[23blocks] ConversationsService is not configured. ' + "Add 'urls.conversations' to your provideBlocks23() configuration.");
|
|
2272
|
+
}
|
|
2273
|
+
return this.block;
|
|
2274
|
+
}
|
|
2275
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2276
|
+
// Messages Service
|
|
2277
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2278
|
+
listMessages(params) {
|
|
2279
|
+
return from(this.ensureConfigured().messages.list(params));
|
|
2280
|
+
}
|
|
2281
|
+
getMessage(uniqueId) {
|
|
2282
|
+
return from(this.ensureConfigured().messages.get(uniqueId));
|
|
2283
|
+
}
|
|
2284
|
+
createMessage(data) {
|
|
2285
|
+
return from(this.ensureConfigured().messages.create(data));
|
|
2286
|
+
}
|
|
2287
|
+
updateMessage(uniqueId, data) {
|
|
2288
|
+
return from(this.ensureConfigured().messages.update(uniqueId, data));
|
|
2289
|
+
}
|
|
2290
|
+
deleteMessage(uniqueId) {
|
|
2291
|
+
return from(this.ensureConfigured().messages.delete(uniqueId));
|
|
2292
|
+
}
|
|
2293
|
+
recoverMessage(uniqueId) {
|
|
2294
|
+
return from(this.ensureConfigured().messages.recover(uniqueId));
|
|
2295
|
+
}
|
|
2296
|
+
listMessagesByContext(contextId, params) {
|
|
2297
|
+
return from(this.ensureConfigured().messages.listByContext(contextId, params));
|
|
2298
|
+
}
|
|
2299
|
+
listMessagesByParent(parentId, params) {
|
|
2300
|
+
return from(this.ensureConfigured().messages.listByParent(parentId, params));
|
|
2301
|
+
}
|
|
2302
|
+
listDeletedMessages(params) {
|
|
2303
|
+
return from(this.ensureConfigured().messages.listDeleted(params));
|
|
2304
|
+
}
|
|
2305
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2306
|
+
// Draft Messages Service
|
|
2307
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2308
|
+
listDraftMessages(params) {
|
|
2309
|
+
return from(this.ensureConfigured().draftMessages.list(params));
|
|
2310
|
+
}
|
|
2311
|
+
getDraftMessage(uniqueId) {
|
|
2312
|
+
return from(this.ensureConfigured().draftMessages.get(uniqueId));
|
|
2313
|
+
}
|
|
2314
|
+
createDraftMessage(data) {
|
|
2315
|
+
return from(this.ensureConfigured().draftMessages.create(data));
|
|
2316
|
+
}
|
|
2317
|
+
updateDraftMessage(uniqueId, data) {
|
|
2318
|
+
return from(this.ensureConfigured().draftMessages.update(uniqueId, data));
|
|
2319
|
+
}
|
|
2320
|
+
deleteDraftMessage(uniqueId) {
|
|
2321
|
+
return from(this.ensureConfigured().draftMessages.delete(uniqueId));
|
|
2322
|
+
}
|
|
2323
|
+
listDraftMessagesByContext(contextId, params) {
|
|
2324
|
+
return from(this.ensureConfigured().draftMessages.listByContext(contextId, params));
|
|
2325
|
+
}
|
|
2326
|
+
publishDraftMessage(uniqueId) {
|
|
2327
|
+
return from(this.ensureConfigured().draftMessages.publish(uniqueId));
|
|
2328
|
+
}
|
|
2329
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2330
|
+
// Groups Service
|
|
2331
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2332
|
+
listGroups(params) {
|
|
2333
|
+
return from(this.ensureConfigured().groups.list(params));
|
|
2334
|
+
}
|
|
2335
|
+
getGroup(uniqueId) {
|
|
2336
|
+
return from(this.ensureConfigured().groups.get(uniqueId));
|
|
2337
|
+
}
|
|
2338
|
+
createGroup(data) {
|
|
2339
|
+
return from(this.ensureConfigured().groups.create(data));
|
|
2340
|
+
}
|
|
2341
|
+
updateGroup(uniqueId, data) {
|
|
2342
|
+
return from(this.ensureConfigured().groups.update(uniqueId, data));
|
|
2343
|
+
}
|
|
2344
|
+
deleteGroup(uniqueId) {
|
|
2345
|
+
return from(this.ensureConfigured().groups.delete(uniqueId));
|
|
2346
|
+
}
|
|
2347
|
+
recoverGroup(uniqueId) {
|
|
2348
|
+
return from(this.ensureConfigured().groups.recover(uniqueId));
|
|
2349
|
+
}
|
|
2350
|
+
searchGroups(query, params) {
|
|
2351
|
+
return from(this.ensureConfigured().groups.search(query, params));
|
|
2352
|
+
}
|
|
2353
|
+
listDeletedGroups(params) {
|
|
2354
|
+
return from(this.ensureConfigured().groups.listDeleted(params));
|
|
2355
|
+
}
|
|
2356
|
+
addGroupMember(uniqueId, memberId) {
|
|
2357
|
+
return from(this.ensureConfigured().groups.addMember(uniqueId, memberId));
|
|
2358
|
+
}
|
|
2359
|
+
removeGroupMember(uniqueId, memberId) {
|
|
2360
|
+
return from(this.ensureConfigured().groups.removeMember(uniqueId, memberId));
|
|
2361
|
+
}
|
|
2362
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2363
|
+
// Notifications Service
|
|
2364
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2365
|
+
listNotifications(params) {
|
|
2366
|
+
return from(this.ensureConfigured().notifications.list(params));
|
|
2367
|
+
}
|
|
2368
|
+
getNotification(uniqueId) {
|
|
2369
|
+
return from(this.ensureConfigured().notifications.get(uniqueId));
|
|
2370
|
+
}
|
|
2371
|
+
createNotification(data) {
|
|
2372
|
+
return from(this.ensureConfigured().notifications.create(data));
|
|
2373
|
+
}
|
|
2374
|
+
updateNotification(uniqueId, data) {
|
|
2375
|
+
return from(this.ensureConfigured().notifications.update(uniqueId, data));
|
|
2376
|
+
}
|
|
2377
|
+
deleteNotification(uniqueId) {
|
|
2378
|
+
return from(this.ensureConfigured().notifications.delete(uniqueId));
|
|
2379
|
+
}
|
|
2380
|
+
markNotificationAsRead(uniqueId) {
|
|
2381
|
+
return from(this.ensureConfigured().notifications.markAsRead(uniqueId));
|
|
2382
|
+
}
|
|
2383
|
+
markNotificationAsUnread(uniqueId) {
|
|
2384
|
+
return from(this.ensureConfigured().notifications.markAsUnread(uniqueId));
|
|
2385
|
+
}
|
|
2386
|
+
listNotificationsByTarget(targetId, params) {
|
|
2387
|
+
return from(this.ensureConfigured().notifications.listByTarget(targetId, params));
|
|
2388
|
+
}
|
|
2389
|
+
listUnreadNotifications(params) {
|
|
2390
|
+
return from(this.ensureConfigured().notifications.listUnread(params));
|
|
2391
|
+
}
|
|
2392
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2393
|
+
// Conversations Service
|
|
2394
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2395
|
+
getConversation(params) {
|
|
2396
|
+
return from(this.ensureConfigured().conversations.get(params));
|
|
2397
|
+
}
|
|
2398
|
+
listContexts() {
|
|
2399
|
+
return from(this.ensureConfigured().conversations.listContexts());
|
|
2400
|
+
}
|
|
2401
|
+
deleteContext(context) {
|
|
2402
|
+
return from(this.ensureConfigured().conversations.deleteContext(context));
|
|
2403
|
+
}
|
|
2404
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2405
|
+
// Direct Block Access (for advanced usage)
|
|
2406
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2407
|
+
/**
|
|
2408
|
+
* Access the underlying block for advanced operations
|
|
2409
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
2410
|
+
*/ get rawBlock() {
|
|
2411
|
+
return this.ensureConfigured();
|
|
2412
|
+
}
|
|
2413
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
2414
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
2415
|
+
this.block = transport ? createConversationsBlock(transport, config) : null;
|
|
2416
|
+
}
|
|
2417
|
+
}, _classThis = _class, (()=>{
|
|
2418
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2419
|
+
__esDecorate(null, _classDescriptor = {
|
|
2420
|
+
value: _classThis
|
|
2421
|
+
}, _classDecorators, {
|
|
2422
|
+
kind: "class",
|
|
2423
|
+
name: _classThis.name,
|
|
2424
|
+
metadata: _metadata
|
|
2425
|
+
}, null, _classExtraInitializers);
|
|
2426
|
+
_classThis = _classDescriptor.value;
|
|
2427
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
2428
|
+
enumerable: true,
|
|
2429
|
+
configurable: true,
|
|
2430
|
+
writable: true,
|
|
2431
|
+
value: _metadata
|
|
2432
|
+
});
|
|
2433
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2434
|
+
})(), _class);
|
|
2435
|
+
return _classThis;
|
|
2436
|
+
})();
|
|
2437
|
+
|
|
2438
|
+
/**
|
|
2439
|
+
* Angular service wrapping the Files block.
|
|
2440
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
2441
|
+
*
|
|
2442
|
+
* @example
|
|
2443
|
+
* ```typescript
|
|
2444
|
+
* @Component({...})
|
|
2445
|
+
* export class FileUploadComponent {
|
|
2446
|
+
* constructor(private files: FilesService) {}
|
|
2447
|
+
*
|
|
2448
|
+
* uploadFile(file: File) {
|
|
2449
|
+
* this.files.uploadStorageFile({
|
|
2450
|
+
* file,
|
|
2451
|
+
* fileName: file.name,
|
|
2452
|
+
* ownerUniqueId: 'user-123',
|
|
2453
|
+
* ownerType: 'User',
|
|
2454
|
+
* }).subscribe({
|
|
2455
|
+
* next: (storageFile) => console.log('Uploaded:', storageFile),
|
|
2456
|
+
* error: (err) => console.error('Failed:', err),
|
|
2457
|
+
* });
|
|
2458
|
+
* }
|
|
2459
|
+
* }
|
|
2460
|
+
* ```
|
|
2461
|
+
*/ let FilesService = (()=>{
|
|
2462
|
+
var _class;
|
|
2463
|
+
let _classDecorators = [
|
|
2464
|
+
Injectable({
|
|
2465
|
+
providedIn: 'root'
|
|
2466
|
+
})
|
|
2467
|
+
];
|
|
2468
|
+
let _classDescriptor;
|
|
2469
|
+
let _classExtraInitializers = [];
|
|
2470
|
+
let _classThis;
|
|
2471
|
+
(_class = class {
|
|
2472
|
+
/**
|
|
2473
|
+
* Ensure the service is configured, throw helpful error if not
|
|
2474
|
+
*/ ensureConfigured() {
|
|
2475
|
+
if (!this.block) {
|
|
2476
|
+
throw new Error('[23blocks] FilesService is not configured. ' + "Add 'urls.files' to your provideBlocks23() configuration.");
|
|
2477
|
+
}
|
|
2478
|
+
return this.block;
|
|
2479
|
+
}
|
|
2480
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2481
|
+
// Storage Files Service
|
|
2482
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2483
|
+
listStorageFiles(params) {
|
|
2484
|
+
return from(this.ensureConfigured().storageFiles.list(params));
|
|
2485
|
+
}
|
|
2486
|
+
getStorageFile(uniqueId) {
|
|
2487
|
+
return from(this.ensureConfigured().storageFiles.get(uniqueId));
|
|
2488
|
+
}
|
|
2489
|
+
uploadStorageFile(data) {
|
|
2490
|
+
return from(this.ensureConfigured().storageFiles.upload(data));
|
|
2491
|
+
}
|
|
2492
|
+
createStorageFile(data) {
|
|
2493
|
+
return from(this.ensureConfigured().storageFiles.create(data));
|
|
2494
|
+
}
|
|
2495
|
+
updateStorageFile(uniqueId, data) {
|
|
2496
|
+
return from(this.ensureConfigured().storageFiles.update(uniqueId, data));
|
|
2497
|
+
}
|
|
2498
|
+
deleteStorageFile(uniqueId) {
|
|
2499
|
+
return from(this.ensureConfigured().storageFiles.delete(uniqueId));
|
|
2500
|
+
}
|
|
2501
|
+
downloadStorageFile(uniqueId) {
|
|
2502
|
+
return from(this.ensureConfigured().storageFiles.download(uniqueId));
|
|
2503
|
+
}
|
|
2504
|
+
listStorageFilesByOwner(ownerUniqueId, ownerType, params) {
|
|
2505
|
+
return from(this.ensureConfigured().storageFiles.listByOwner(ownerUniqueId, ownerType, params));
|
|
2506
|
+
}
|
|
2507
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2508
|
+
// Entity Files Service
|
|
2509
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2510
|
+
listEntityFiles(params) {
|
|
2511
|
+
return from(this.ensureConfigured().entityFiles.list(params));
|
|
2512
|
+
}
|
|
2513
|
+
getEntityFile(uniqueId) {
|
|
2514
|
+
return from(this.ensureConfigured().entityFiles.get(uniqueId));
|
|
2515
|
+
}
|
|
2516
|
+
attachFile(data) {
|
|
2517
|
+
return from(this.ensureConfigured().entityFiles.attach(data));
|
|
2518
|
+
}
|
|
2519
|
+
detachFile(uniqueId) {
|
|
2520
|
+
return from(this.ensureConfigured().entityFiles.detach(uniqueId));
|
|
2521
|
+
}
|
|
2522
|
+
updateEntityFile(uniqueId, data) {
|
|
2523
|
+
return from(this.ensureConfigured().entityFiles.update(uniqueId, data));
|
|
2524
|
+
}
|
|
2525
|
+
reorderEntityFiles(entityUniqueId, entityType, data) {
|
|
2526
|
+
return from(this.ensureConfigured().entityFiles.reorder(entityUniqueId, entityType, data));
|
|
2527
|
+
}
|
|
2528
|
+
listEntityFilesByEntity(entityUniqueId, entityType, params) {
|
|
2529
|
+
return from(this.ensureConfigured().entityFiles.listByEntity(entityUniqueId, entityType, params));
|
|
2530
|
+
}
|
|
2531
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2532
|
+
// File Schemas Service
|
|
2533
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2534
|
+
listFileSchemas(params) {
|
|
2535
|
+
return from(this.ensureConfigured().fileSchemas.list(params));
|
|
2536
|
+
}
|
|
2537
|
+
getFileSchema(uniqueId) {
|
|
2538
|
+
return from(this.ensureConfigured().fileSchemas.get(uniqueId));
|
|
2539
|
+
}
|
|
2540
|
+
getFileSchemaByCode(code) {
|
|
2541
|
+
return from(this.ensureConfigured().fileSchemas.getByCode(code));
|
|
2542
|
+
}
|
|
2543
|
+
createFileSchema(data) {
|
|
2544
|
+
return from(this.ensureConfigured().fileSchemas.create(data));
|
|
2545
|
+
}
|
|
2546
|
+
updateFileSchema(uniqueId, data) {
|
|
2547
|
+
return from(this.ensureConfigured().fileSchemas.update(uniqueId, data));
|
|
2548
|
+
}
|
|
2549
|
+
deleteFileSchema(uniqueId) {
|
|
2550
|
+
return from(this.ensureConfigured().fileSchemas.delete(uniqueId));
|
|
2551
|
+
}
|
|
2552
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2553
|
+
// Direct Block Access (for advanced usage)
|
|
2554
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2555
|
+
/**
|
|
2556
|
+
* Access the underlying block for advanced operations
|
|
2557
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
2558
|
+
*/ get rawBlock() {
|
|
2559
|
+
return this.ensureConfigured();
|
|
2560
|
+
}
|
|
2561
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
2562
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
2563
|
+
this.block = transport ? createFilesBlock(transport, config) : null;
|
|
2564
|
+
}
|
|
2565
|
+
}, _classThis = _class, (()=>{
|
|
2566
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2567
|
+
__esDecorate(null, _classDescriptor = {
|
|
2568
|
+
value: _classThis
|
|
2569
|
+
}, _classDecorators, {
|
|
2570
|
+
kind: "class",
|
|
2571
|
+
name: _classThis.name,
|
|
2572
|
+
metadata: _metadata
|
|
2573
|
+
}, null, _classExtraInitializers);
|
|
2574
|
+
_classThis = _classDescriptor.value;
|
|
2575
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
2576
|
+
enumerable: true,
|
|
2577
|
+
configurable: true,
|
|
2578
|
+
writable: true,
|
|
2579
|
+
value: _metadata
|
|
2580
|
+
});
|
|
2581
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2582
|
+
})(), _class);
|
|
2583
|
+
return _classThis;
|
|
2584
|
+
})();
|
|
2585
|
+
|
|
2586
|
+
/**
|
|
2587
|
+
* Angular service wrapping the Forms block.
|
|
2588
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
2589
|
+
*
|
|
2590
|
+
* @example
|
|
2591
|
+
* ```typescript
|
|
2592
|
+
* @Component({...})
|
|
2593
|
+
* export class FormComponent {
|
|
2594
|
+
* constructor(private formsService: FormsService) {}
|
|
2595
|
+
*
|
|
2596
|
+
* loadForms() {
|
|
2597
|
+
* this.formsService.listForms().subscribe({
|
|
2598
|
+
* next: (result) => console.log('Forms:', result.data),
|
|
2599
|
+
* error: (err) => console.error('Failed:', err),
|
|
2600
|
+
* });
|
|
2601
|
+
* }
|
|
2602
|
+
* }
|
|
2603
|
+
* ```
|
|
2604
|
+
*/ let FormsService = (()=>{
|
|
2605
|
+
var _class;
|
|
2606
|
+
let _classDecorators = [
|
|
2607
|
+
Injectable({
|
|
2608
|
+
providedIn: 'root'
|
|
2609
|
+
})
|
|
2610
|
+
];
|
|
2611
|
+
let _classDescriptor;
|
|
2612
|
+
let _classExtraInitializers = [];
|
|
2613
|
+
let _classThis;
|
|
2614
|
+
(_class = class {
|
|
2615
|
+
/**
|
|
2616
|
+
* Ensure the service is configured, throw helpful error if not
|
|
2617
|
+
*/ ensureConfigured() {
|
|
2618
|
+
if (!this.block) {
|
|
2619
|
+
throw new Error('[23blocks] FormsService is not configured. ' + "Add 'urls.forms' to your provideBlocks23() configuration.");
|
|
2620
|
+
}
|
|
2621
|
+
return this.block;
|
|
2622
|
+
}
|
|
2623
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2624
|
+
// Forms Service
|
|
2625
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2626
|
+
listForms(params) {
|
|
2627
|
+
return from(this.ensureConfigured().forms.list(params));
|
|
2628
|
+
}
|
|
2629
|
+
getForm(uniqueId) {
|
|
2630
|
+
return from(this.ensureConfigured().forms.get(uniqueId));
|
|
2631
|
+
}
|
|
2632
|
+
createForm(data) {
|
|
2633
|
+
return from(this.ensureConfigured().forms.create(data));
|
|
2634
|
+
}
|
|
2635
|
+
updateForm(uniqueId, data) {
|
|
2636
|
+
return from(this.ensureConfigured().forms.update(uniqueId, data));
|
|
2637
|
+
}
|
|
2638
|
+
deleteForm(uniqueId) {
|
|
2639
|
+
return from(this.ensureConfigured().forms.delete(uniqueId));
|
|
2640
|
+
}
|
|
2641
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2642
|
+
// Form Schemas Service
|
|
2643
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2644
|
+
listFormSchemas(params) {
|
|
2645
|
+
return from(this.ensureConfigured().schemas.list(params));
|
|
2646
|
+
}
|
|
2647
|
+
getFormSchema(uniqueId) {
|
|
2648
|
+
return from(this.ensureConfigured().schemas.get(uniqueId));
|
|
2649
|
+
}
|
|
2650
|
+
createFormSchema(data) {
|
|
2651
|
+
return from(this.ensureConfigured().schemas.create(data));
|
|
2652
|
+
}
|
|
2653
|
+
updateFormSchema(uniqueId, data) {
|
|
2654
|
+
return from(this.ensureConfigured().schemas.update(uniqueId, data));
|
|
2655
|
+
}
|
|
2656
|
+
deleteFormSchema(uniqueId) {
|
|
2657
|
+
return from(this.ensureConfigured().schemas.delete(uniqueId));
|
|
2658
|
+
}
|
|
2659
|
+
getLatestFormSchemaVersion(formUniqueId) {
|
|
2660
|
+
return from(this.ensureConfigured().schemas.getLatestVersion(formUniqueId));
|
|
2661
|
+
}
|
|
2662
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2663
|
+
// Form Instances Service
|
|
2664
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2665
|
+
listFormInstances(params) {
|
|
2666
|
+
return from(this.ensureConfigured().instances.list(params));
|
|
2667
|
+
}
|
|
2668
|
+
getFormInstance(uniqueId) {
|
|
2669
|
+
return from(this.ensureConfigured().instances.get(uniqueId));
|
|
2670
|
+
}
|
|
2671
|
+
createFormInstance(data) {
|
|
2672
|
+
return from(this.ensureConfigured().instances.create(data));
|
|
2673
|
+
}
|
|
2674
|
+
updateFormInstance(uniqueId, data) {
|
|
2675
|
+
return from(this.ensureConfigured().instances.update(uniqueId, data));
|
|
2676
|
+
}
|
|
2677
|
+
deleteFormInstance(uniqueId) {
|
|
2678
|
+
return from(this.ensureConfigured().instances.delete(uniqueId));
|
|
2679
|
+
}
|
|
2680
|
+
submitFormInstance(data) {
|
|
2681
|
+
return from(this.ensureConfigured().instances.submit(data));
|
|
2682
|
+
}
|
|
2683
|
+
listFormInstancesByUser(userUniqueId, params) {
|
|
2684
|
+
return from(this.ensureConfigured().instances.listByUser(userUniqueId, params));
|
|
2685
|
+
}
|
|
2686
|
+
listFormInstancesBySchema(formSchemaUniqueId, params) {
|
|
2687
|
+
return from(this.ensureConfigured().instances.listBySchema(formSchemaUniqueId, params));
|
|
2688
|
+
}
|
|
2689
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2690
|
+
// Form Sets Service
|
|
2691
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2692
|
+
listFormSets(params) {
|
|
2693
|
+
return from(this.ensureConfigured().sets.list(params));
|
|
2694
|
+
}
|
|
2695
|
+
getFormSet(uniqueId) {
|
|
2696
|
+
return from(this.ensureConfigured().sets.get(uniqueId));
|
|
2697
|
+
}
|
|
2698
|
+
createFormSet(data) {
|
|
2699
|
+
return from(this.ensureConfigured().sets.create(data));
|
|
2700
|
+
}
|
|
2701
|
+
updateFormSet(uniqueId, data) {
|
|
2702
|
+
return from(this.ensureConfigured().sets.update(uniqueId, data));
|
|
2703
|
+
}
|
|
2704
|
+
deleteFormSet(uniqueId) {
|
|
2705
|
+
return from(this.ensureConfigured().sets.delete(uniqueId));
|
|
2706
|
+
}
|
|
2707
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2708
|
+
// Direct Block Access (for advanced usage)
|
|
2709
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2710
|
+
/**
|
|
2711
|
+
* Access the underlying block for advanced operations
|
|
2712
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
2713
|
+
*/ get rawBlock() {
|
|
2714
|
+
return this.ensureConfigured();
|
|
2715
|
+
}
|
|
2716
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
2717
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
2718
|
+
this.block = transport ? createFormsBlock(transport, config) : null;
|
|
2719
|
+
}
|
|
2720
|
+
}, _classThis = _class, (()=>{
|
|
2721
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2722
|
+
__esDecorate(null, _classDescriptor = {
|
|
2723
|
+
value: _classThis
|
|
2724
|
+
}, _classDecorators, {
|
|
2725
|
+
kind: "class",
|
|
2726
|
+
name: _classThis.name,
|
|
2727
|
+
metadata: _metadata
|
|
2728
|
+
}, null, _classExtraInitializers);
|
|
2729
|
+
_classThis = _classDescriptor.value;
|
|
2730
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
2731
|
+
enumerable: true,
|
|
2732
|
+
configurable: true,
|
|
2733
|
+
writable: true,
|
|
2734
|
+
value: _metadata
|
|
2735
|
+
});
|
|
2736
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2737
|
+
})(), _class);
|
|
2738
|
+
return _classThis;
|
|
2739
|
+
})();
|
|
2740
|
+
|
|
2741
|
+
/**
|
|
2742
|
+
* Angular service wrapping the Assets block.
|
|
2743
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
2744
|
+
*
|
|
2745
|
+
* @example
|
|
2746
|
+
* ```typescript
|
|
2747
|
+
* @Component({...})
|
|
2748
|
+
* export class AssetManagementComponent {
|
|
2749
|
+
* constructor(private assets: AssetsService) {}
|
|
2750
|
+
*
|
|
2751
|
+
* loadAssets() {
|
|
2752
|
+
* this.assets.listAssets().subscribe({
|
|
2753
|
+
* next: (result) => console.log('Assets:', result.data),
|
|
2754
|
+
* error: (err) => console.error('Failed:', err),
|
|
2755
|
+
* });
|
|
2756
|
+
* }
|
|
2757
|
+
* }
|
|
2758
|
+
* ```
|
|
2759
|
+
*/ let AssetsService = (()=>{
|
|
2760
|
+
var _class;
|
|
2761
|
+
let _classDecorators = [
|
|
2762
|
+
Injectable({
|
|
2763
|
+
providedIn: 'root'
|
|
2764
|
+
})
|
|
2765
|
+
];
|
|
2766
|
+
let _classDescriptor;
|
|
2767
|
+
let _classExtraInitializers = [];
|
|
2768
|
+
let _classThis;
|
|
2769
|
+
(_class = class {
|
|
2770
|
+
/**
|
|
2771
|
+
* Ensure the service is configured, throw helpful error if not
|
|
2772
|
+
*/ ensureConfigured() {
|
|
2773
|
+
if (!this.block) {
|
|
2774
|
+
throw new Error('[23blocks] AssetsService is not configured. ' + "Add 'urls.assets' to your provideBlocks23() configuration.");
|
|
2775
|
+
}
|
|
2776
|
+
return this.block;
|
|
2777
|
+
}
|
|
2778
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2779
|
+
// Assets Service
|
|
2780
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2781
|
+
listAssets(params) {
|
|
2782
|
+
return from(this.ensureConfigured().assets.list(params));
|
|
2783
|
+
}
|
|
2784
|
+
getAsset(uniqueId) {
|
|
2785
|
+
return from(this.ensureConfigured().assets.get(uniqueId));
|
|
2786
|
+
}
|
|
2787
|
+
createAsset(data) {
|
|
2788
|
+
return from(this.ensureConfigured().assets.create(data));
|
|
2789
|
+
}
|
|
2790
|
+
updateAsset(uniqueId, data) {
|
|
2791
|
+
return from(this.ensureConfigured().assets.update(uniqueId, data));
|
|
2792
|
+
}
|
|
2793
|
+
deleteAsset(uniqueId) {
|
|
2794
|
+
return from(this.ensureConfigured().assets.delete(uniqueId));
|
|
2795
|
+
}
|
|
2796
|
+
transferAsset(uniqueId, data) {
|
|
2797
|
+
return from(this.ensureConfigured().assets.transfer(uniqueId, data));
|
|
2798
|
+
}
|
|
2799
|
+
assignAsset(uniqueId, data) {
|
|
2800
|
+
return from(this.ensureConfigured().assets.assign(uniqueId, data));
|
|
2801
|
+
}
|
|
2802
|
+
unassignAsset(uniqueId) {
|
|
2803
|
+
return from(this.ensureConfigured().assets.unassign(uniqueId));
|
|
2804
|
+
}
|
|
2805
|
+
listAssetsByLocation(locationUniqueId, params) {
|
|
2806
|
+
return from(this.ensureConfigured().assets.listByLocation(locationUniqueId, params));
|
|
2807
|
+
}
|
|
2808
|
+
listAssetsByAssignee(assignedToUniqueId, params) {
|
|
2809
|
+
return from(this.ensureConfigured().assets.listByAssignee(assignedToUniqueId, params));
|
|
2810
|
+
}
|
|
2811
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2812
|
+
// Asset Events Service
|
|
2813
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2814
|
+
listAssetEvents(params) {
|
|
2815
|
+
return from(this.ensureConfigured().events.list(params));
|
|
2816
|
+
}
|
|
2817
|
+
getAssetEvent(uniqueId) {
|
|
2818
|
+
return from(this.ensureConfigured().events.get(uniqueId));
|
|
2819
|
+
}
|
|
2820
|
+
createAssetEvent(data) {
|
|
2821
|
+
return from(this.ensureConfigured().events.create(data));
|
|
2822
|
+
}
|
|
2823
|
+
updateAssetEvent(uniqueId, data) {
|
|
2824
|
+
return from(this.ensureConfigured().events.update(uniqueId, data));
|
|
2825
|
+
}
|
|
2826
|
+
deleteAssetEvent(uniqueId) {
|
|
2827
|
+
return from(this.ensureConfigured().events.delete(uniqueId));
|
|
2828
|
+
}
|
|
2829
|
+
listAssetEventsByAsset(assetUniqueId, params) {
|
|
2830
|
+
return from(this.ensureConfigured().events.listByAsset(assetUniqueId, params));
|
|
2831
|
+
}
|
|
2832
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2833
|
+
// Asset Audits Service
|
|
2834
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2835
|
+
listAssetAudits(params) {
|
|
2836
|
+
return from(this.ensureConfigured().audits.list(params));
|
|
2837
|
+
}
|
|
2838
|
+
getAssetAudit(uniqueId) {
|
|
2839
|
+
return from(this.ensureConfigured().audits.get(uniqueId));
|
|
2840
|
+
}
|
|
2841
|
+
createAssetAudit(data) {
|
|
2842
|
+
return from(this.ensureConfigured().audits.create(data));
|
|
2843
|
+
}
|
|
2844
|
+
updateAssetAudit(uniqueId, data) {
|
|
2845
|
+
return from(this.ensureConfigured().audits.update(uniqueId, data));
|
|
2846
|
+
}
|
|
2847
|
+
deleteAssetAudit(uniqueId) {
|
|
2848
|
+
return from(this.ensureConfigured().audits.delete(uniqueId));
|
|
2849
|
+
}
|
|
2850
|
+
listAssetAuditsByAsset(assetUniqueId, params) {
|
|
2851
|
+
return from(this.ensureConfigured().audits.listByAsset(assetUniqueId, params));
|
|
2852
|
+
}
|
|
2853
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2854
|
+
// Direct Block Access (for advanced usage)
|
|
2855
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
2856
|
+
/**
|
|
2857
|
+
* Access the underlying block for advanced operations
|
|
2858
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
2859
|
+
*/ get rawBlock() {
|
|
2860
|
+
return this.ensureConfigured();
|
|
2861
|
+
}
|
|
2862
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
2863
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
2864
|
+
this.block = transport ? createAssetsBlock(transport, config) : null;
|
|
2865
|
+
}
|
|
2866
|
+
}, _classThis = _class, (()=>{
|
|
2867
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
2868
|
+
__esDecorate(null, _classDescriptor = {
|
|
2869
|
+
value: _classThis
|
|
2870
|
+
}, _classDecorators, {
|
|
2871
|
+
kind: "class",
|
|
2872
|
+
name: _classThis.name,
|
|
2873
|
+
metadata: _metadata
|
|
2874
|
+
}, null, _classExtraInitializers);
|
|
2875
|
+
_classThis = _classDescriptor.value;
|
|
2876
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
2877
|
+
enumerable: true,
|
|
2878
|
+
configurable: true,
|
|
2879
|
+
writable: true,
|
|
2880
|
+
value: _metadata
|
|
2881
|
+
});
|
|
2882
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
2883
|
+
})(), _class);
|
|
2884
|
+
return _classThis;
|
|
2885
|
+
})();
|
|
2886
|
+
|
|
2887
|
+
/**
|
|
2888
|
+
* Angular service wrapping the Campaigns block.
|
|
2889
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
2890
|
+
*
|
|
2891
|
+
* @example
|
|
2892
|
+
* ```typescript
|
|
2893
|
+
* @Component({...})
|
|
2894
|
+
* export class CampaignsComponent {
|
|
2895
|
+
* constructor(private campaigns: CampaignsService) {}
|
|
2896
|
+
*
|
|
2897
|
+
* loadCampaigns() {
|
|
2898
|
+
* this.campaigns.listCampaigns({ page: 1, perPage: 10 }).subscribe({
|
|
2899
|
+
* next: (result) => console.log('Campaigns:', result.data),
|
|
2900
|
+
* error: (err) => console.error('Failed:', err),
|
|
2901
|
+
* });
|
|
2902
|
+
* }
|
|
2903
|
+
* }
|
|
2904
|
+
* ```
|
|
2905
|
+
*/ let CampaignsService = (()=>{
|
|
2906
|
+
var _class;
|
|
2907
|
+
let _classDecorators = [
|
|
2908
|
+
Injectable({
|
|
2909
|
+
providedIn: 'root'
|
|
2910
|
+
})
|
|
2911
|
+
];
|
|
2912
|
+
let _classDescriptor;
|
|
2913
|
+
let _classExtraInitializers = [];
|
|
2914
|
+
let _classThis;
|
|
2915
|
+
(_class = class {
|
|
2916
|
+
/**
|
|
2917
|
+
* Ensure the service is configured, throw helpful error if not
|
|
2918
|
+
*/ ensureConfigured() {
|
|
2919
|
+
if (!this.block) {
|
|
2920
|
+
throw new Error('[23blocks] CampaignsService is not configured. ' + "Add 'urls.campaigns' to your provideBlocks23() configuration.");
|
|
2921
|
+
}
|
|
2922
|
+
return this.block;
|
|
2923
|
+
}
|
|
2924
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2925
|
+
// Campaigns Service
|
|
2926
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2927
|
+
listCampaigns(params) {
|
|
2928
|
+
return from(this.ensureConfigured().campaigns.list(params));
|
|
2929
|
+
}
|
|
2930
|
+
getCampaign(uniqueId) {
|
|
2931
|
+
return from(this.ensureConfigured().campaigns.get(uniqueId));
|
|
2932
|
+
}
|
|
2933
|
+
createCampaign(data) {
|
|
2934
|
+
return from(this.ensureConfigured().campaigns.create(data));
|
|
2935
|
+
}
|
|
2936
|
+
updateCampaign(uniqueId, data) {
|
|
2937
|
+
return from(this.ensureConfigured().campaigns.update(uniqueId, data));
|
|
2938
|
+
}
|
|
2939
|
+
deleteCampaign(uniqueId) {
|
|
2940
|
+
return from(this.ensureConfigured().campaigns.delete(uniqueId));
|
|
2941
|
+
}
|
|
2942
|
+
startCampaign(uniqueId) {
|
|
2943
|
+
return from(this.ensureConfigured().campaigns.start(uniqueId));
|
|
2944
|
+
}
|
|
2945
|
+
pauseCampaign(uniqueId) {
|
|
2946
|
+
return from(this.ensureConfigured().campaigns.pause(uniqueId));
|
|
2947
|
+
}
|
|
2948
|
+
stopCampaign(uniqueId) {
|
|
2949
|
+
return from(this.ensureConfigured().campaigns.stop(uniqueId));
|
|
2950
|
+
}
|
|
2951
|
+
getCampaignResults(uniqueId) {
|
|
2952
|
+
return from(this.ensureConfigured().campaigns.getResults(uniqueId));
|
|
2953
|
+
}
|
|
2954
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2955
|
+
// Campaign Media Service
|
|
2956
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2957
|
+
listMedia(params) {
|
|
2958
|
+
return from(this.ensureConfigured().media.list(params));
|
|
2959
|
+
}
|
|
2960
|
+
getMedia(uniqueId) {
|
|
2961
|
+
return from(this.ensureConfigured().media.get(uniqueId));
|
|
2962
|
+
}
|
|
2963
|
+
createMedia(data) {
|
|
2964
|
+
return from(this.ensureConfigured().media.create(data));
|
|
2965
|
+
}
|
|
2966
|
+
updateMedia(uniqueId, data) {
|
|
2967
|
+
return from(this.ensureConfigured().media.update(uniqueId, data));
|
|
2968
|
+
}
|
|
2969
|
+
deleteMedia(uniqueId) {
|
|
2970
|
+
return from(this.ensureConfigured().media.delete(uniqueId));
|
|
2971
|
+
}
|
|
2972
|
+
listMediaByCampaign(campaignUniqueId) {
|
|
2973
|
+
return from(this.ensureConfigured().media.listByCampaign(campaignUniqueId));
|
|
2974
|
+
}
|
|
2975
|
+
getMediaResults(uniqueId) {
|
|
2976
|
+
return from(this.ensureConfigured().media.getResults(uniqueId));
|
|
2977
|
+
}
|
|
2978
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2979
|
+
// Landing Pages Service
|
|
2980
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2981
|
+
listLandingPages(params) {
|
|
2982
|
+
return from(this.ensureConfigured().landingPages.list(params));
|
|
2983
|
+
}
|
|
2984
|
+
getLandingPage(uniqueId) {
|
|
2985
|
+
return from(this.ensureConfigured().landingPages.get(uniqueId));
|
|
2986
|
+
}
|
|
2987
|
+
createLandingPage(data) {
|
|
2988
|
+
return from(this.ensureConfigured().landingPages.create(data));
|
|
2989
|
+
}
|
|
2990
|
+
updateLandingPage(uniqueId, data) {
|
|
2991
|
+
return from(this.ensureConfigured().landingPages.update(uniqueId, data));
|
|
2992
|
+
}
|
|
2993
|
+
deleteLandingPage(uniqueId) {
|
|
2994
|
+
return from(this.ensureConfigured().landingPages.delete(uniqueId));
|
|
2995
|
+
}
|
|
2996
|
+
publishLandingPage(uniqueId) {
|
|
2997
|
+
return from(this.ensureConfigured().landingPages.publish(uniqueId));
|
|
2998
|
+
}
|
|
2999
|
+
unpublishLandingPage(uniqueId) {
|
|
3000
|
+
return from(this.ensureConfigured().landingPages.unpublish(uniqueId));
|
|
3001
|
+
}
|
|
3002
|
+
getLandingPageBySlug(slug) {
|
|
3003
|
+
return from(this.ensureConfigured().landingPages.getBySlug(slug));
|
|
3004
|
+
}
|
|
3005
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3006
|
+
// Audiences Service
|
|
3007
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3008
|
+
listAudiences(params) {
|
|
3009
|
+
return from(this.ensureConfigured().audiences.list(params));
|
|
3010
|
+
}
|
|
3011
|
+
getAudience(uniqueId) {
|
|
3012
|
+
return from(this.ensureConfigured().audiences.get(uniqueId));
|
|
3013
|
+
}
|
|
3014
|
+
createAudience(data) {
|
|
3015
|
+
return from(this.ensureConfigured().audiences.create(data));
|
|
3016
|
+
}
|
|
3017
|
+
updateAudience(uniqueId, data) {
|
|
3018
|
+
return from(this.ensureConfigured().audiences.update(uniqueId, data));
|
|
3019
|
+
}
|
|
3020
|
+
deleteAudience(uniqueId) {
|
|
3021
|
+
return from(this.ensureConfigured().audiences.delete(uniqueId));
|
|
3022
|
+
}
|
|
3023
|
+
getAudienceMembers(uniqueId) {
|
|
3024
|
+
return from(this.ensureConfigured().audiences.getMembers(uniqueId));
|
|
3025
|
+
}
|
|
3026
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3027
|
+
// Direct Block Access (for advanced usage)
|
|
3028
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3029
|
+
/**
|
|
3030
|
+
* Access the underlying block for advanced operations
|
|
3031
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
3032
|
+
*/ get rawBlock() {
|
|
3033
|
+
return this.ensureConfigured();
|
|
3034
|
+
}
|
|
3035
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
3036
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
3037
|
+
this.block = transport ? createCampaignsBlock(transport, config) : null;
|
|
3038
|
+
}
|
|
3039
|
+
}, _classThis = _class, (()=>{
|
|
3040
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3041
|
+
__esDecorate(null, _classDescriptor = {
|
|
3042
|
+
value: _classThis
|
|
3043
|
+
}, _classDecorators, {
|
|
3044
|
+
kind: "class",
|
|
3045
|
+
name: _classThis.name,
|
|
3046
|
+
metadata: _metadata
|
|
3047
|
+
}, null, _classExtraInitializers);
|
|
3048
|
+
_classThis = _classDescriptor.value;
|
|
3049
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
3050
|
+
enumerable: true,
|
|
3051
|
+
configurable: true,
|
|
3052
|
+
writable: true,
|
|
3053
|
+
value: _metadata
|
|
3054
|
+
});
|
|
3055
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3056
|
+
})(), _class);
|
|
3057
|
+
return _classThis;
|
|
3058
|
+
})();
|
|
3059
|
+
|
|
3060
|
+
/**
|
|
3061
|
+
* Angular service wrapping the Company block.
|
|
3062
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
3063
|
+
*
|
|
3064
|
+
* @example
|
|
3065
|
+
* ```typescript
|
|
3066
|
+
* @Component({...})
|
|
3067
|
+
* export class CompanyComponent {
|
|
3068
|
+
* constructor(private company: CompanyService) {}
|
|
3069
|
+
*
|
|
3070
|
+
* createCompany(name: string) {
|
|
3071
|
+
* this.company.createCompany({ name, code: 'COMP001' }).subscribe({
|
|
3072
|
+
* next: (company) => console.log('Company created:', company),
|
|
3073
|
+
* error: (err) => console.error('Failed:', err),
|
|
3074
|
+
* });
|
|
3075
|
+
* }
|
|
3076
|
+
* }
|
|
3077
|
+
* ```
|
|
3078
|
+
*/ let CompanyService = (()=>{
|
|
3079
|
+
var _class;
|
|
3080
|
+
let _classDecorators = [
|
|
3081
|
+
Injectable({
|
|
3082
|
+
providedIn: 'root'
|
|
3083
|
+
})
|
|
3084
|
+
];
|
|
3085
|
+
let _classDescriptor;
|
|
3086
|
+
let _classExtraInitializers = [];
|
|
3087
|
+
let _classThis;
|
|
3088
|
+
(_class = class {
|
|
3089
|
+
/**
|
|
3090
|
+
* Ensure the service is configured, throw helpful error if not
|
|
3091
|
+
*/ ensureConfigured() {
|
|
3092
|
+
if (!this.block) {
|
|
3093
|
+
throw new Error('[23blocks] CompanyService is not configured. ' + "Add 'urls.company' to your provideBlocks23() configuration.");
|
|
3094
|
+
}
|
|
3095
|
+
return this.block;
|
|
3096
|
+
}
|
|
3097
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3098
|
+
// Companies Service
|
|
3099
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3100
|
+
listCompanies(params) {
|
|
3101
|
+
return from(this.ensureConfigured().companies.list(params));
|
|
3102
|
+
}
|
|
3103
|
+
getCompany(uniqueId) {
|
|
3104
|
+
return from(this.ensureConfigured().companies.get(uniqueId));
|
|
3105
|
+
}
|
|
3106
|
+
createCompany(request) {
|
|
3107
|
+
return from(this.ensureConfigured().companies.create(request));
|
|
3108
|
+
}
|
|
3109
|
+
updateCompany(uniqueId, request) {
|
|
3110
|
+
return from(this.ensureConfigured().companies.update(uniqueId, request));
|
|
3111
|
+
}
|
|
3112
|
+
deleteCompany(uniqueId) {
|
|
3113
|
+
return from(this.ensureConfigured().companies.delete(uniqueId));
|
|
3114
|
+
}
|
|
3115
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3116
|
+
// Departments Service
|
|
3117
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3118
|
+
listDepartments(params) {
|
|
3119
|
+
return from(this.ensureConfigured().departments.list(params));
|
|
3120
|
+
}
|
|
3121
|
+
getDepartment(uniqueId) {
|
|
3122
|
+
return from(this.ensureConfigured().departments.get(uniqueId));
|
|
3123
|
+
}
|
|
3124
|
+
createDepartment(request) {
|
|
3125
|
+
return from(this.ensureConfigured().departments.create(request));
|
|
3126
|
+
}
|
|
3127
|
+
updateDepartment(uniqueId, request) {
|
|
3128
|
+
return from(this.ensureConfigured().departments.update(uniqueId, request));
|
|
3129
|
+
}
|
|
3130
|
+
deleteDepartment(uniqueId) {
|
|
3131
|
+
return from(this.ensureConfigured().departments.delete(uniqueId));
|
|
3132
|
+
}
|
|
3133
|
+
listDepartmentsByCompany(companyUniqueId) {
|
|
3134
|
+
return from(this.ensureConfigured().departments.listByCompany(companyUniqueId));
|
|
3135
|
+
}
|
|
3136
|
+
getDepartmentHierarchy(companyUniqueId) {
|
|
3137
|
+
return from(this.ensureConfigured().departments.getHierarchy(companyUniqueId));
|
|
3138
|
+
}
|
|
3139
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3140
|
+
// Teams Service
|
|
3141
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3142
|
+
listTeams(params) {
|
|
3143
|
+
return from(this.ensureConfigured().teams.list(params));
|
|
3144
|
+
}
|
|
3145
|
+
getTeam(uniqueId) {
|
|
3146
|
+
return from(this.ensureConfigured().teams.get(uniqueId));
|
|
3147
|
+
}
|
|
3148
|
+
createTeam(request) {
|
|
3149
|
+
return from(this.ensureConfigured().teams.create(request));
|
|
3150
|
+
}
|
|
3151
|
+
updateTeam(uniqueId, request) {
|
|
3152
|
+
return from(this.ensureConfigured().teams.update(uniqueId, request));
|
|
3153
|
+
}
|
|
3154
|
+
deleteTeam(uniqueId) {
|
|
3155
|
+
return from(this.ensureConfigured().teams.delete(uniqueId));
|
|
3156
|
+
}
|
|
3157
|
+
listTeamsByDepartment(departmentUniqueId) {
|
|
3158
|
+
return from(this.ensureConfigured().teams.listByDepartment(departmentUniqueId));
|
|
3159
|
+
}
|
|
3160
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3161
|
+
// Team Members Service
|
|
3162
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3163
|
+
listTeamMembers(params) {
|
|
3164
|
+
return from(this.ensureConfigured().teamMembers.list(params));
|
|
3165
|
+
}
|
|
3166
|
+
getTeamMember(uniqueId) {
|
|
3167
|
+
return from(this.ensureConfigured().teamMembers.get(uniqueId));
|
|
3168
|
+
}
|
|
3169
|
+
addTeamMember(request) {
|
|
3170
|
+
return from(this.ensureConfigured().teamMembers.add(request));
|
|
3171
|
+
}
|
|
3172
|
+
updateTeamMember(uniqueId, request) {
|
|
3173
|
+
return from(this.ensureConfigured().teamMembers.update(uniqueId, request));
|
|
3174
|
+
}
|
|
3175
|
+
removeTeamMember(uniqueId) {
|
|
3176
|
+
return from(this.ensureConfigured().teamMembers.remove(uniqueId));
|
|
3177
|
+
}
|
|
3178
|
+
listTeamMembersByTeam(teamUniqueId) {
|
|
3179
|
+
return from(this.ensureConfigured().teamMembers.listByTeam(teamUniqueId));
|
|
3180
|
+
}
|
|
3181
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3182
|
+
// Quarters Service
|
|
3183
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3184
|
+
listQuarters(params) {
|
|
3185
|
+
return from(this.ensureConfigured().quarters.list(params));
|
|
3186
|
+
}
|
|
3187
|
+
getQuarter(uniqueId) {
|
|
3188
|
+
return from(this.ensureConfigured().quarters.get(uniqueId));
|
|
3189
|
+
}
|
|
3190
|
+
createQuarter(request) {
|
|
3191
|
+
return from(this.ensureConfigured().quarters.create(request));
|
|
3192
|
+
}
|
|
3193
|
+
updateQuarter(uniqueId, request) {
|
|
3194
|
+
return from(this.ensureConfigured().quarters.update(uniqueId, request));
|
|
3195
|
+
}
|
|
3196
|
+
deleteQuarter(uniqueId) {
|
|
3197
|
+
return from(this.ensureConfigured().quarters.delete(uniqueId));
|
|
3198
|
+
}
|
|
3199
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3200
|
+
// Direct Block Access (for advanced usage)
|
|
3201
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3202
|
+
/**
|
|
3203
|
+
* Access the underlying block for advanced operations
|
|
3204
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
3205
|
+
*/ get rawBlock() {
|
|
3206
|
+
return this.ensureConfigured();
|
|
3207
|
+
}
|
|
3208
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
3209
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
3210
|
+
this.block = transport ? createCompanyBlock(transport, config) : null;
|
|
3211
|
+
}
|
|
3212
|
+
}, _classThis = _class, (()=>{
|
|
3213
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3214
|
+
__esDecorate(null, _classDescriptor = {
|
|
3215
|
+
value: _classThis
|
|
3216
|
+
}, _classDecorators, {
|
|
3217
|
+
kind: "class",
|
|
3218
|
+
name: _classThis.name,
|
|
3219
|
+
metadata: _metadata
|
|
3220
|
+
}, null, _classExtraInitializers);
|
|
3221
|
+
_classThis = _classDescriptor.value;
|
|
3222
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
3223
|
+
enumerable: true,
|
|
3224
|
+
configurable: true,
|
|
3225
|
+
writable: true,
|
|
3226
|
+
value: _metadata
|
|
3227
|
+
});
|
|
3228
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3229
|
+
})(), _class);
|
|
3230
|
+
return _classThis;
|
|
3231
|
+
})();
|
|
3232
|
+
|
|
3233
|
+
/**
|
|
3234
|
+
* Angular service wrapping the Rewards block.
|
|
3235
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
3236
|
+
*
|
|
3237
|
+
* @example
|
|
3238
|
+
* ```typescript
|
|
3239
|
+
* @Component({...})
|
|
3240
|
+
* export class RewardsComponent {
|
|
3241
|
+
* constructor(private rewards: RewardsService) {}
|
|
3242
|
+
*
|
|
3243
|
+
* listRewards() {
|
|
3244
|
+
* this.rewards.listRewards({ status: 'active' }).subscribe({
|
|
3245
|
+
* next: (result) => console.log('Rewards:', result.data),
|
|
3246
|
+
* error: (err) => console.error('Failed:', err),
|
|
3247
|
+
* });
|
|
3248
|
+
* }
|
|
3249
|
+
* }
|
|
3250
|
+
* ```
|
|
3251
|
+
*/ let RewardsService = (()=>{
|
|
3252
|
+
var _class;
|
|
3253
|
+
let _classDecorators = [
|
|
3254
|
+
Injectable({
|
|
3255
|
+
providedIn: 'root'
|
|
3256
|
+
})
|
|
3257
|
+
];
|
|
3258
|
+
let _classDescriptor;
|
|
3259
|
+
let _classExtraInitializers = [];
|
|
3260
|
+
let _classThis;
|
|
3261
|
+
(_class = class {
|
|
3262
|
+
/**
|
|
3263
|
+
* Ensure the service is configured, throw helpful error if not
|
|
3264
|
+
*/ ensureConfigured() {
|
|
3265
|
+
if (!this.block) {
|
|
3266
|
+
throw new Error('[23blocks] RewardsService is not configured. ' + "Add 'urls.rewards' to your provideBlocks23() configuration.");
|
|
3267
|
+
}
|
|
3268
|
+
return this.block;
|
|
3269
|
+
}
|
|
3270
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3271
|
+
// Rewards Service
|
|
3272
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3273
|
+
listRewards(params) {
|
|
3274
|
+
return from(this.ensureConfigured().rewards.list(params));
|
|
3275
|
+
}
|
|
3276
|
+
getReward(uniqueId) {
|
|
3277
|
+
return from(this.ensureConfigured().rewards.get(uniqueId));
|
|
3278
|
+
}
|
|
3279
|
+
createReward(data) {
|
|
3280
|
+
return from(this.ensureConfigured().rewards.create(data));
|
|
3281
|
+
}
|
|
3282
|
+
updateReward(uniqueId, data) {
|
|
3283
|
+
return from(this.ensureConfigured().rewards.update(uniqueId, data));
|
|
3284
|
+
}
|
|
3285
|
+
deleteReward(uniqueId) {
|
|
3286
|
+
return from(this.ensureConfigured().rewards.delete(uniqueId));
|
|
3287
|
+
}
|
|
3288
|
+
redeemReward(data) {
|
|
3289
|
+
return from(this.ensureConfigured().rewards.redeem(data));
|
|
3290
|
+
}
|
|
3291
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3292
|
+
// Coupons Service
|
|
3293
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3294
|
+
listCoupons(params) {
|
|
3295
|
+
return from(this.ensureConfigured().coupons.list(params));
|
|
3296
|
+
}
|
|
3297
|
+
getCoupon(uniqueId) {
|
|
3298
|
+
return from(this.ensureConfigured().coupons.get(uniqueId));
|
|
3299
|
+
}
|
|
3300
|
+
getCouponByCode(code) {
|
|
3301
|
+
return from(this.ensureConfigured().coupons.getByCode(code));
|
|
3302
|
+
}
|
|
3303
|
+
createCoupon(data) {
|
|
3304
|
+
return from(this.ensureConfigured().coupons.create(data));
|
|
3305
|
+
}
|
|
3306
|
+
updateCoupon(uniqueId, data) {
|
|
3307
|
+
return from(this.ensureConfigured().coupons.update(uniqueId, data));
|
|
3308
|
+
}
|
|
3309
|
+
deleteCoupon(uniqueId) {
|
|
3310
|
+
return from(this.ensureConfigured().coupons.delete(uniqueId));
|
|
3311
|
+
}
|
|
3312
|
+
validateCoupon(data) {
|
|
3313
|
+
return from(this.ensureConfigured().coupons.validate(data));
|
|
3314
|
+
}
|
|
3315
|
+
applyCoupon(data) {
|
|
3316
|
+
return from(this.ensureConfigured().coupons.apply(data));
|
|
3317
|
+
}
|
|
3318
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3319
|
+
// Loyalty Service
|
|
3320
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3321
|
+
getLoyalty(uniqueId) {
|
|
3322
|
+
return from(this.ensureConfigured().loyalty.get(uniqueId));
|
|
3323
|
+
}
|
|
3324
|
+
getLoyaltyByUser(userUniqueId) {
|
|
3325
|
+
return from(this.ensureConfigured().loyalty.getByUser(userUniqueId));
|
|
3326
|
+
}
|
|
3327
|
+
addPoints(data) {
|
|
3328
|
+
return from(this.ensureConfigured().loyalty.addPoints(data));
|
|
3329
|
+
}
|
|
3330
|
+
redeemPoints(data) {
|
|
3331
|
+
return from(this.ensureConfigured().loyalty.redeemPoints(data));
|
|
3332
|
+
}
|
|
3333
|
+
getLoyaltyHistory(userUniqueId, params) {
|
|
3334
|
+
return from(this.ensureConfigured().loyalty.getHistory(userUniqueId, params));
|
|
3335
|
+
}
|
|
3336
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3337
|
+
// Badges Service
|
|
3338
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3339
|
+
listBadges(params) {
|
|
3340
|
+
return from(this.ensureConfigured().badges.list(params));
|
|
3341
|
+
}
|
|
3342
|
+
getBadge(uniqueId) {
|
|
3343
|
+
return from(this.ensureConfigured().badges.get(uniqueId));
|
|
3344
|
+
}
|
|
3345
|
+
createBadge(data) {
|
|
3346
|
+
return from(this.ensureConfigured().badges.create(data));
|
|
3347
|
+
}
|
|
3348
|
+
updateBadge(uniqueId, data) {
|
|
3349
|
+
return from(this.ensureConfigured().badges.update(uniqueId, data));
|
|
3350
|
+
}
|
|
3351
|
+
deleteBadge(uniqueId) {
|
|
3352
|
+
return from(this.ensureConfigured().badges.delete(uniqueId));
|
|
3353
|
+
}
|
|
3354
|
+
awardBadge(data) {
|
|
3355
|
+
return from(this.ensureConfigured().badges.award(data));
|
|
3356
|
+
}
|
|
3357
|
+
listUserBadges(userUniqueId, params) {
|
|
3358
|
+
return from(this.ensureConfigured().badges.listByUser(userUniqueId, params));
|
|
3359
|
+
}
|
|
3360
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3361
|
+
// Direct Block Access (for advanced usage)
|
|
3362
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3363
|
+
/**
|
|
3364
|
+
* Access the underlying block for advanced operations
|
|
3365
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
3366
|
+
*/ get rawBlock() {
|
|
3367
|
+
return this.ensureConfigured();
|
|
3368
|
+
}
|
|
3369
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
3370
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
3371
|
+
this.block = transport ? createRewardsBlock(transport, config) : null;
|
|
3372
|
+
}
|
|
3373
|
+
}, _classThis = _class, (()=>{
|
|
3374
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3375
|
+
__esDecorate(null, _classDescriptor = {
|
|
3376
|
+
value: _classThis
|
|
3377
|
+
}, _classDecorators, {
|
|
3378
|
+
kind: "class",
|
|
3379
|
+
name: _classThis.name,
|
|
3380
|
+
metadata: _metadata
|
|
3381
|
+
}, null, _classExtraInitializers);
|
|
3382
|
+
_classThis = _classDescriptor.value;
|
|
3383
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
3384
|
+
enumerable: true,
|
|
3385
|
+
configurable: true,
|
|
3386
|
+
writable: true,
|
|
3387
|
+
value: _metadata
|
|
3388
|
+
});
|
|
3389
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3390
|
+
})(), _class);
|
|
3391
|
+
return _classThis;
|
|
3392
|
+
})();
|
|
3393
|
+
|
|
3394
|
+
/**
|
|
3395
|
+
* Angular service wrapping the Sales block.
|
|
3396
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
3397
|
+
*
|
|
3398
|
+
* @example
|
|
3399
|
+
* ```typescript
|
|
3400
|
+
* @Component({...})
|
|
3401
|
+
* export class CheckoutComponent {
|
|
3402
|
+
* constructor(private sales: SalesService) {}
|
|
3403
|
+
*
|
|
3404
|
+
* createOrder(items: any[]) {
|
|
3405
|
+
* this.sales.createOrder({ userUniqueId: '123', items }).subscribe({
|
|
3406
|
+
* next: (order) => console.log('Order created:', order),
|
|
3407
|
+
* error: (err) => console.error('Failed:', err),
|
|
3408
|
+
* });
|
|
3409
|
+
* }
|
|
3410
|
+
* }
|
|
3411
|
+
* ```
|
|
3412
|
+
*/ let SalesService = (()=>{
|
|
3413
|
+
var _class;
|
|
3414
|
+
let _classDecorators = [
|
|
3415
|
+
Injectable({
|
|
3416
|
+
providedIn: 'root'
|
|
3417
|
+
})
|
|
3418
|
+
];
|
|
3419
|
+
let _classDescriptor;
|
|
3420
|
+
let _classExtraInitializers = [];
|
|
3421
|
+
let _classThis;
|
|
3422
|
+
(_class = class {
|
|
3423
|
+
/**
|
|
3424
|
+
* Ensure the service is configured, throw helpful error if not
|
|
3425
|
+
*/ ensureConfigured() {
|
|
3426
|
+
if (!this.block) {
|
|
3427
|
+
throw new Error('[23blocks] SalesService is not configured. ' + "Add 'urls.sales' to your provideBlocks23() configuration.");
|
|
3428
|
+
}
|
|
3429
|
+
return this.block;
|
|
3430
|
+
}
|
|
3431
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3432
|
+
// Orders Service
|
|
3433
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3434
|
+
listOrders(params) {
|
|
3435
|
+
return from(this.ensureConfigured().orders.list(params));
|
|
3436
|
+
}
|
|
3437
|
+
getOrder(uniqueId) {
|
|
3438
|
+
return from(this.ensureConfigured().orders.get(uniqueId));
|
|
3439
|
+
}
|
|
3440
|
+
createOrder(data) {
|
|
3441
|
+
return from(this.ensureConfigured().orders.create(data));
|
|
3442
|
+
}
|
|
3443
|
+
updateOrder(uniqueId, data) {
|
|
3444
|
+
return from(this.ensureConfigured().orders.update(uniqueId, data));
|
|
3445
|
+
}
|
|
3446
|
+
cancelOrder(uniqueId) {
|
|
3447
|
+
return from(this.ensureConfigured().orders.cancel(uniqueId));
|
|
3448
|
+
}
|
|
3449
|
+
confirmOrder(uniqueId) {
|
|
3450
|
+
return from(this.ensureConfigured().orders.confirm(uniqueId));
|
|
3451
|
+
}
|
|
3452
|
+
shipOrder(uniqueId, trackingNumber) {
|
|
3453
|
+
return from(this.ensureConfigured().orders.ship(uniqueId, trackingNumber));
|
|
3454
|
+
}
|
|
3455
|
+
deliverOrder(uniqueId) {
|
|
3456
|
+
return from(this.ensureConfigured().orders.deliver(uniqueId));
|
|
3457
|
+
}
|
|
3458
|
+
listOrdersByUser(userUniqueId, params) {
|
|
3459
|
+
return from(this.ensureConfigured().orders.listByUser(userUniqueId, params));
|
|
3460
|
+
}
|
|
3461
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3462
|
+
// Order Details Service
|
|
3463
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3464
|
+
listOrderDetails() {
|
|
3465
|
+
return from(this.ensureConfigured().orderDetails.list());
|
|
3466
|
+
}
|
|
3467
|
+
getOrderDetail(uniqueId) {
|
|
3468
|
+
return from(this.ensureConfigured().orderDetails.get(uniqueId));
|
|
3469
|
+
}
|
|
3470
|
+
updateOrderDetail(uniqueId, data) {
|
|
3471
|
+
return from(this.ensureConfigured().orderDetails.update(uniqueId, data));
|
|
3472
|
+
}
|
|
3473
|
+
listOrderDetailsByOrder(orderUniqueId) {
|
|
3474
|
+
return from(this.ensureConfigured().orderDetails.listByOrder(orderUniqueId));
|
|
3475
|
+
}
|
|
3476
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3477
|
+
// Payments Service
|
|
3478
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3479
|
+
listPayments(params) {
|
|
3480
|
+
return from(this.ensureConfigured().payments.list(params));
|
|
3481
|
+
}
|
|
3482
|
+
getPayment(uniqueId) {
|
|
3483
|
+
return from(this.ensureConfigured().payments.get(uniqueId));
|
|
3484
|
+
}
|
|
3485
|
+
createPayment(data) {
|
|
3486
|
+
return from(this.ensureConfigured().payments.create(data));
|
|
3487
|
+
}
|
|
3488
|
+
refundPayment(uniqueId, amount) {
|
|
3489
|
+
return from(this.ensureConfigured().payments.refund(uniqueId, amount));
|
|
3490
|
+
}
|
|
3491
|
+
listPaymentsByOrder(orderUniqueId) {
|
|
3492
|
+
return from(this.ensureConfigured().payments.listByOrder(orderUniqueId));
|
|
3493
|
+
}
|
|
3494
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3495
|
+
// Subscriptions Service
|
|
3496
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3497
|
+
listSubscriptions(params) {
|
|
3498
|
+
return from(this.ensureConfigured().subscriptions.list(params));
|
|
3499
|
+
}
|
|
3500
|
+
getSubscription(uniqueId) {
|
|
3501
|
+
return from(this.ensureConfigured().subscriptions.get(uniqueId));
|
|
3502
|
+
}
|
|
3503
|
+
createSubscription(data) {
|
|
3504
|
+
return from(this.ensureConfigured().subscriptions.create(data));
|
|
3505
|
+
}
|
|
3506
|
+
updateSubscription(uniqueId, data) {
|
|
3507
|
+
return from(this.ensureConfigured().subscriptions.update(uniqueId, data));
|
|
3508
|
+
}
|
|
3509
|
+
cancelSubscription(uniqueId) {
|
|
3510
|
+
return from(this.ensureConfigured().subscriptions.cancel(uniqueId));
|
|
3511
|
+
}
|
|
3512
|
+
pauseSubscription(uniqueId) {
|
|
3513
|
+
return from(this.ensureConfigured().subscriptions.pause(uniqueId));
|
|
3514
|
+
}
|
|
3515
|
+
resumeSubscription(uniqueId) {
|
|
3516
|
+
return from(this.ensureConfigured().subscriptions.resume(uniqueId));
|
|
3517
|
+
}
|
|
3518
|
+
listSubscriptionsByUser(userUniqueId, params) {
|
|
3519
|
+
return from(this.ensureConfigured().subscriptions.listByUser(userUniqueId, params));
|
|
3520
|
+
}
|
|
3521
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3522
|
+
// Direct Block Access (for advanced usage)
|
|
3523
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
3524
|
+
/**
|
|
3525
|
+
* Access the underlying block for advanced operations
|
|
3526
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
3527
|
+
*/ get rawBlock() {
|
|
3528
|
+
return this.ensureConfigured();
|
|
3529
|
+
}
|
|
3530
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
3531
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
3532
|
+
this.block = transport ? createSalesBlock(transport, config) : null;
|
|
3533
|
+
}
|
|
3534
|
+
}, _classThis = _class, (()=>{
|
|
3535
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3536
|
+
__esDecorate(null, _classDescriptor = {
|
|
3537
|
+
value: _classThis
|
|
3538
|
+
}, _classDecorators, {
|
|
3539
|
+
kind: "class",
|
|
3540
|
+
name: _classThis.name,
|
|
3541
|
+
metadata: _metadata
|
|
3542
|
+
}, null, _classExtraInitializers);
|
|
3543
|
+
_classThis = _classDescriptor.value;
|
|
3544
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
3545
|
+
enumerable: true,
|
|
3546
|
+
configurable: true,
|
|
3547
|
+
writable: true,
|
|
3548
|
+
value: _metadata
|
|
3549
|
+
});
|
|
3550
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3551
|
+
})(), _class);
|
|
3552
|
+
return _classThis;
|
|
3553
|
+
})();
|
|
3554
|
+
|
|
3555
|
+
/**
|
|
3556
|
+
* Angular service wrapping the Wallet block.
|
|
3557
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
3558
|
+
*
|
|
3559
|
+
* @example
|
|
3560
|
+
* ```typescript
|
|
3561
|
+
* @Component({...})
|
|
3562
|
+
* export class WalletComponent {
|
|
3563
|
+
* constructor(private wallet: WalletService) {}
|
|
3564
|
+
*
|
|
3565
|
+
* createWallet(userUniqueId: string) {
|
|
3566
|
+
* this.wallet.createWallet({ userUniqueId }).subscribe({
|
|
3567
|
+
* next: (wallet) => console.log('Created:', wallet),
|
|
3568
|
+
* error: (err) => console.error('Failed:', err),
|
|
3569
|
+
* });
|
|
3570
|
+
* }
|
|
3571
|
+
* }
|
|
3572
|
+
* ```
|
|
3573
|
+
*/ let WalletService = (()=>{
|
|
3574
|
+
var _class;
|
|
3575
|
+
let _classDecorators = [
|
|
3576
|
+
Injectable({
|
|
3577
|
+
providedIn: 'root'
|
|
3578
|
+
})
|
|
3579
|
+
];
|
|
3580
|
+
let _classDescriptor;
|
|
3581
|
+
let _classExtraInitializers = [];
|
|
3582
|
+
let _classThis;
|
|
3583
|
+
(_class = class {
|
|
3584
|
+
/**
|
|
3585
|
+
* Ensure the service is configured, throw helpful error if not
|
|
3586
|
+
*/ ensureConfigured() {
|
|
3587
|
+
if (!this.block) {
|
|
3588
|
+
throw new Error('[23blocks] WalletService is not configured. ' + "Add 'urls.wallet' to your provideBlocks23() configuration.");
|
|
3589
|
+
}
|
|
3590
|
+
return this.block;
|
|
3591
|
+
}
|
|
3592
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3593
|
+
// Wallets Service
|
|
3594
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3595
|
+
listWallets(params) {
|
|
3596
|
+
return from(this.ensureConfigured().wallets.list(params));
|
|
3597
|
+
}
|
|
3598
|
+
getWallet(uniqueId) {
|
|
3599
|
+
return from(this.ensureConfigured().wallets.get(uniqueId));
|
|
3600
|
+
}
|
|
3601
|
+
getWalletByUser(userUniqueId) {
|
|
3602
|
+
return from(this.ensureConfigured().wallets.getByUser(userUniqueId));
|
|
3603
|
+
}
|
|
3604
|
+
createWallet(data) {
|
|
3605
|
+
return from(this.ensureConfigured().wallets.create(data));
|
|
3606
|
+
}
|
|
3607
|
+
updateWallet(uniqueId, data) {
|
|
3608
|
+
return from(this.ensureConfigured().wallets.update(uniqueId, data));
|
|
3609
|
+
}
|
|
3610
|
+
creditWallet(uniqueId, data) {
|
|
3611
|
+
return from(this.ensureConfigured().wallets.credit(uniqueId, data));
|
|
3612
|
+
}
|
|
3613
|
+
debitWallet(uniqueId, data) {
|
|
3614
|
+
return from(this.ensureConfigured().wallets.debit(uniqueId, data));
|
|
3615
|
+
}
|
|
3616
|
+
getWalletBalance(uniqueId) {
|
|
3617
|
+
return from(this.ensureConfigured().wallets.getBalance(uniqueId));
|
|
3618
|
+
}
|
|
3619
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3620
|
+
// Transactions Service
|
|
3621
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3622
|
+
listTransactions(params) {
|
|
3623
|
+
return from(this.ensureConfigured().transactions.list(params));
|
|
3624
|
+
}
|
|
3625
|
+
getTransaction(uniqueId) {
|
|
3626
|
+
return from(this.ensureConfigured().transactions.get(uniqueId));
|
|
3627
|
+
}
|
|
3628
|
+
listTransactionsByWallet(walletUniqueId, params) {
|
|
3629
|
+
return from(this.ensureConfigured().transactions.listByWallet(walletUniqueId, params));
|
|
3630
|
+
}
|
|
3631
|
+
listTransactionsByReference(referenceType, referenceUniqueId, params) {
|
|
3632
|
+
return from(this.ensureConfigured().transactions.listByReference(referenceType, referenceUniqueId, params));
|
|
3633
|
+
}
|
|
3634
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3635
|
+
// Authorization Codes Service
|
|
3636
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3637
|
+
listAuthorizationCodes(params) {
|
|
3638
|
+
return from(this.ensureConfigured().authorizationCodes.list(params));
|
|
3639
|
+
}
|
|
3640
|
+
getAuthorizationCode(uniqueId) {
|
|
3641
|
+
return from(this.ensureConfigured().authorizationCodes.get(uniqueId));
|
|
3642
|
+
}
|
|
3643
|
+
createAuthorizationCode(data) {
|
|
3644
|
+
return from(this.ensureConfigured().authorizationCodes.create(data));
|
|
3645
|
+
}
|
|
3646
|
+
validateAuthorizationCode(data) {
|
|
3647
|
+
return from(this.ensureConfigured().authorizationCodes.validate(data));
|
|
3648
|
+
}
|
|
3649
|
+
useAuthorizationCode(data) {
|
|
3650
|
+
return from(this.ensureConfigured().authorizationCodes.use(data));
|
|
3651
|
+
}
|
|
3652
|
+
invalidateAuthorizationCode(uniqueId) {
|
|
3653
|
+
return from(this.ensureConfigured().authorizationCodes.invalidate(uniqueId));
|
|
3654
|
+
}
|
|
3655
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3656
|
+
// Direct Block Access (for advanced usage)
|
|
3657
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3658
|
+
/**
|
|
3659
|
+
* Access the underlying block for advanced operations
|
|
3660
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
3661
|
+
*/ get rawBlock() {
|
|
3662
|
+
return this.ensureConfigured();
|
|
3663
|
+
}
|
|
3664
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
3665
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
3666
|
+
this.block = transport ? createWalletBlock(transport, config) : null;
|
|
3667
|
+
}
|
|
3668
|
+
}, _classThis = _class, (()=>{
|
|
3669
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3670
|
+
__esDecorate(null, _classDescriptor = {
|
|
3671
|
+
value: _classThis
|
|
3672
|
+
}, _classDecorators, {
|
|
3673
|
+
kind: "class",
|
|
3674
|
+
name: _classThis.name,
|
|
3675
|
+
metadata: _metadata
|
|
3676
|
+
}, null, _classExtraInitializers);
|
|
3677
|
+
_classThis = _classDescriptor.value;
|
|
3678
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
3679
|
+
enumerable: true,
|
|
3680
|
+
configurable: true,
|
|
3681
|
+
writable: true,
|
|
3682
|
+
value: _metadata
|
|
3683
|
+
});
|
|
3684
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3685
|
+
})(), _class);
|
|
3686
|
+
return _classThis;
|
|
3687
|
+
})();
|
|
3688
|
+
|
|
3689
|
+
/**
|
|
3690
|
+
* Angular service wrapping the Jarvis block.
|
|
3691
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
3692
|
+
*
|
|
3693
|
+
* @example
|
|
3694
|
+
* ```typescript
|
|
3695
|
+
* @Component({...})
|
|
3696
|
+
* export class ChatComponent {
|
|
3697
|
+
* constructor(private jarvis: JarvisService) {}
|
|
3698
|
+
*
|
|
3699
|
+
* sendMessage(agentId: string, message: string) {
|
|
3700
|
+
* this.jarvis.chat(agentId, { message }).subscribe({
|
|
3701
|
+
* next: (response) => console.log('Response:', response.response),
|
|
3702
|
+
* error: (err) => console.error('Failed:', err),
|
|
3703
|
+
* });
|
|
3704
|
+
* }
|
|
3705
|
+
* }
|
|
3706
|
+
* ```
|
|
3707
|
+
*/ let JarvisService = (()=>{
|
|
3708
|
+
var _class;
|
|
3709
|
+
let _classDecorators = [
|
|
3710
|
+
Injectable({
|
|
3711
|
+
providedIn: 'root'
|
|
3712
|
+
})
|
|
3713
|
+
];
|
|
3714
|
+
let _classDescriptor;
|
|
3715
|
+
let _classExtraInitializers = [];
|
|
3716
|
+
let _classThis;
|
|
3717
|
+
(_class = class {
|
|
3718
|
+
/**
|
|
3719
|
+
* Ensure the service is configured, throw helpful error if not
|
|
3720
|
+
*/ ensureConfigured() {
|
|
3721
|
+
if (!this.block) {
|
|
3722
|
+
throw new Error('[23blocks] JarvisService is not configured. ' + "Add 'urls.jarvis' to your provideBlocks23() configuration.");
|
|
3723
|
+
}
|
|
3724
|
+
return this.block;
|
|
3725
|
+
}
|
|
3726
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3727
|
+
// Agents Service
|
|
3728
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3729
|
+
listAgents(params) {
|
|
3730
|
+
return from(this.ensureConfigured().agents.list(params));
|
|
3731
|
+
}
|
|
3732
|
+
getAgent(uniqueId) {
|
|
3733
|
+
return from(this.ensureConfigured().agents.get(uniqueId));
|
|
3734
|
+
}
|
|
3735
|
+
createAgent(data) {
|
|
3736
|
+
return from(this.ensureConfigured().agents.create(data));
|
|
3737
|
+
}
|
|
3738
|
+
updateAgent(uniqueId, data) {
|
|
3739
|
+
return from(this.ensureConfigured().agents.update(uniqueId, data));
|
|
3740
|
+
}
|
|
3741
|
+
deleteAgent(uniqueId) {
|
|
3742
|
+
return from(this.ensureConfigured().agents.delete(uniqueId));
|
|
3743
|
+
}
|
|
3744
|
+
chat(uniqueId, data) {
|
|
3745
|
+
return from(this.ensureConfigured().agents.chat(uniqueId, data));
|
|
3746
|
+
}
|
|
3747
|
+
complete(uniqueId, data) {
|
|
3748
|
+
return from(this.ensureConfigured().agents.complete(uniqueId, data));
|
|
3749
|
+
}
|
|
3750
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3751
|
+
// Prompts Service
|
|
3752
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3753
|
+
listPrompts(params) {
|
|
3754
|
+
return from(this.ensureConfigured().prompts.list(params));
|
|
3755
|
+
}
|
|
3756
|
+
getPrompt(uniqueId) {
|
|
3757
|
+
return from(this.ensureConfigured().prompts.get(uniqueId));
|
|
3758
|
+
}
|
|
3759
|
+
createPrompt(data) {
|
|
3760
|
+
return from(this.ensureConfigured().prompts.create(data));
|
|
3761
|
+
}
|
|
3762
|
+
updatePrompt(uniqueId, data) {
|
|
3763
|
+
return from(this.ensureConfigured().prompts.update(uniqueId, data));
|
|
3764
|
+
}
|
|
3765
|
+
deletePrompt(uniqueId) {
|
|
3766
|
+
return from(this.ensureConfigured().prompts.delete(uniqueId));
|
|
3767
|
+
}
|
|
3768
|
+
executePrompt(uniqueId, data) {
|
|
3769
|
+
return from(this.ensureConfigured().prompts.execute(uniqueId, data));
|
|
3770
|
+
}
|
|
3771
|
+
testPrompt(data) {
|
|
3772
|
+
return from(this.ensureConfigured().prompts.test(data));
|
|
3773
|
+
}
|
|
3774
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3775
|
+
// Workflows Service
|
|
3776
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3777
|
+
listWorkflows(params) {
|
|
3778
|
+
return from(this.ensureConfigured().workflows.list(params));
|
|
3779
|
+
}
|
|
3780
|
+
getWorkflow(uniqueId) {
|
|
3781
|
+
return from(this.ensureConfigured().workflows.get(uniqueId));
|
|
3782
|
+
}
|
|
3783
|
+
createWorkflow(data) {
|
|
3784
|
+
return from(this.ensureConfigured().workflows.create(data));
|
|
3785
|
+
}
|
|
3786
|
+
updateWorkflow(uniqueId, data) {
|
|
3787
|
+
return from(this.ensureConfigured().workflows.update(uniqueId, data));
|
|
3788
|
+
}
|
|
3789
|
+
deleteWorkflow(uniqueId) {
|
|
3790
|
+
return from(this.ensureConfigured().workflows.delete(uniqueId));
|
|
3791
|
+
}
|
|
3792
|
+
runWorkflow(uniqueId, data) {
|
|
3793
|
+
return from(this.ensureConfigured().workflows.run(uniqueId, data));
|
|
3794
|
+
}
|
|
3795
|
+
pauseWorkflow(uniqueId) {
|
|
3796
|
+
return from(this.ensureConfigured().workflows.pause(uniqueId));
|
|
3797
|
+
}
|
|
3798
|
+
resumeWorkflow(uniqueId) {
|
|
3799
|
+
return from(this.ensureConfigured().workflows.resume(uniqueId));
|
|
3800
|
+
}
|
|
3801
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3802
|
+
// Executions Service
|
|
3803
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3804
|
+
listExecutions(params) {
|
|
3805
|
+
return from(this.ensureConfigured().executions.list(params));
|
|
3806
|
+
}
|
|
3807
|
+
getExecution(uniqueId) {
|
|
3808
|
+
return from(this.ensureConfigured().executions.get(uniqueId));
|
|
3809
|
+
}
|
|
3810
|
+
listExecutionsByAgent(agentUniqueId, params) {
|
|
3811
|
+
return from(this.ensureConfigured().executions.listByAgent(agentUniqueId, params));
|
|
3812
|
+
}
|
|
3813
|
+
listExecutionsByPrompt(promptUniqueId, params) {
|
|
3814
|
+
return from(this.ensureConfigured().executions.listByPrompt(promptUniqueId, params));
|
|
3815
|
+
}
|
|
3816
|
+
cancelExecution(uniqueId) {
|
|
3817
|
+
return from(this.ensureConfigured().executions.cancel(uniqueId));
|
|
3818
|
+
}
|
|
3819
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3820
|
+
// Conversations Service
|
|
3821
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3822
|
+
listConversations(params) {
|
|
3823
|
+
return from(this.ensureConfigured().conversations.list(params));
|
|
3824
|
+
}
|
|
3825
|
+
getConversation(uniqueId) {
|
|
3826
|
+
return from(this.ensureConfigured().conversations.get(uniqueId));
|
|
3827
|
+
}
|
|
3828
|
+
createConversation(data) {
|
|
3829
|
+
return from(this.ensureConfigured().conversations.create(data));
|
|
3830
|
+
}
|
|
3831
|
+
sendMessage(uniqueId, data) {
|
|
3832
|
+
return from(this.ensureConfigured().conversations.sendMessage(uniqueId, data));
|
|
3833
|
+
}
|
|
3834
|
+
listConversationsByUser(userUniqueId, params) {
|
|
3835
|
+
return from(this.ensureConfigured().conversations.listByUser(userUniqueId, params));
|
|
3836
|
+
}
|
|
3837
|
+
clearConversation(uniqueId) {
|
|
3838
|
+
return from(this.ensureConfigured().conversations.clear(uniqueId));
|
|
3839
|
+
}
|
|
3840
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3841
|
+
// Direct Block Access (for advanced usage)
|
|
3842
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3843
|
+
/**
|
|
3844
|
+
* Access the underlying block for advanced operations
|
|
3845
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
3846
|
+
*/ get rawBlock() {
|
|
3847
|
+
return this.ensureConfigured();
|
|
3848
|
+
}
|
|
3849
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
3850
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
3851
|
+
this.block = transport ? createJarvisBlock(transport, config) : null;
|
|
3852
|
+
}
|
|
3853
|
+
}, _classThis = _class, (()=>{
|
|
3854
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
3855
|
+
__esDecorate(null, _classDescriptor = {
|
|
3856
|
+
value: _classThis
|
|
3857
|
+
}, _classDecorators, {
|
|
3858
|
+
kind: "class",
|
|
3859
|
+
name: _classThis.name,
|
|
3860
|
+
metadata: _metadata
|
|
3861
|
+
}, null, _classExtraInitializers);
|
|
3862
|
+
_classThis = _classDescriptor.value;
|
|
3863
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
3864
|
+
enumerable: true,
|
|
3865
|
+
configurable: true,
|
|
3866
|
+
writable: true,
|
|
3867
|
+
value: _metadata
|
|
3868
|
+
});
|
|
3869
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
3870
|
+
})(), _class);
|
|
3871
|
+
return _classThis;
|
|
3872
|
+
})();
|
|
3873
|
+
|
|
3874
|
+
/**
|
|
3875
|
+
* Angular service wrapping the Onboarding block.
|
|
3876
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
3877
|
+
*
|
|
3878
|
+
* @example
|
|
3879
|
+
* ```typescript
|
|
3880
|
+
* @Component({...})
|
|
3881
|
+
* export class OnboardingComponent {
|
|
3882
|
+
* constructor(private onboarding: OnboardingService) {}
|
|
3883
|
+
*
|
|
3884
|
+
* createOnboarding() {
|
|
3885
|
+
* this.onboarding.createOnboarding({
|
|
3886
|
+
* code: 'user-onboarding',
|
|
3887
|
+
* name: 'User Onboarding',
|
|
3888
|
+
* steps: []
|
|
3889
|
+
* }).subscribe({
|
|
3890
|
+
* next: (onboarding) => console.log('Created:', onboarding),
|
|
3891
|
+
* error: (err) => console.error('Failed:', err),
|
|
3892
|
+
* });
|
|
3893
|
+
* }
|
|
3894
|
+
* }
|
|
3895
|
+
* ```
|
|
3896
|
+
*/ let OnboardingService = (()=>{
|
|
3897
|
+
var _class;
|
|
3898
|
+
let _classDecorators = [
|
|
3899
|
+
Injectable({
|
|
3900
|
+
providedIn: 'root'
|
|
3901
|
+
})
|
|
3902
|
+
];
|
|
3903
|
+
let _classDescriptor;
|
|
3904
|
+
let _classExtraInitializers = [];
|
|
3905
|
+
let _classThis;
|
|
3906
|
+
(_class = class {
|
|
3907
|
+
/**
|
|
3908
|
+
* Ensure the service is configured, throw helpful error if not
|
|
3909
|
+
*/ ensureConfigured() {
|
|
3910
|
+
if (!this.block) {
|
|
3911
|
+
throw new Error('[23blocks] OnboardingService is not configured. ' + "Add 'urls.onboarding' to your provideBlocks23() configuration.");
|
|
3912
|
+
}
|
|
3913
|
+
return this.block;
|
|
3914
|
+
}
|
|
3915
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3916
|
+
// Onboardings Service
|
|
3917
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3918
|
+
listOnboardings(params) {
|
|
3919
|
+
return from(this.ensureConfigured().onboardings.list(params));
|
|
3920
|
+
}
|
|
3921
|
+
getOnboarding(uniqueId) {
|
|
3922
|
+
return from(this.ensureConfigured().onboardings.get(uniqueId));
|
|
3923
|
+
}
|
|
3924
|
+
createOnboarding(request) {
|
|
3925
|
+
return from(this.ensureConfigured().onboardings.create(request));
|
|
3926
|
+
}
|
|
3927
|
+
updateOnboarding(uniqueId, request) {
|
|
3928
|
+
return from(this.ensureConfigured().onboardings.update(uniqueId, request));
|
|
3929
|
+
}
|
|
3930
|
+
deleteOnboarding(uniqueId) {
|
|
3931
|
+
return from(this.ensureConfigured().onboardings.delete(uniqueId));
|
|
3932
|
+
}
|
|
3933
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3934
|
+
// Flows Service
|
|
3935
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3936
|
+
listFlows(params) {
|
|
3937
|
+
return from(this.ensureConfigured().flows.list(params));
|
|
3938
|
+
}
|
|
3939
|
+
getFlow(uniqueId) {
|
|
3940
|
+
return from(this.ensureConfigured().flows.get(uniqueId));
|
|
3941
|
+
}
|
|
3942
|
+
createFlow(request) {
|
|
3943
|
+
return from(this.ensureConfigured().flows.create(request));
|
|
3944
|
+
}
|
|
3945
|
+
updateFlow(uniqueId, request) {
|
|
3946
|
+
return from(this.ensureConfigured().flows.update(uniqueId, request));
|
|
3947
|
+
}
|
|
3948
|
+
deleteFlow(uniqueId) {
|
|
3949
|
+
return from(this.ensureConfigured().flows.delete(uniqueId));
|
|
3950
|
+
}
|
|
3951
|
+
listFlowsByOnboarding(onboardingUniqueId) {
|
|
3952
|
+
return from(this.ensureConfigured().flows.listByOnboarding(onboardingUniqueId));
|
|
3953
|
+
}
|
|
3954
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3955
|
+
// User Journeys Service
|
|
3956
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3957
|
+
listUserJourneys(params) {
|
|
3958
|
+
return from(this.ensureConfigured().userJourneys.list(params));
|
|
3959
|
+
}
|
|
3960
|
+
getUserJourney(uniqueId) {
|
|
3961
|
+
return from(this.ensureConfigured().userJourneys.get(uniqueId));
|
|
3962
|
+
}
|
|
3963
|
+
startJourney(request) {
|
|
3964
|
+
return from(this.ensureConfigured().userJourneys.start(request));
|
|
3965
|
+
}
|
|
3966
|
+
completeStep(uniqueId, request) {
|
|
3967
|
+
return from(this.ensureConfigured().userJourneys.completeStep(uniqueId, request));
|
|
3968
|
+
}
|
|
3969
|
+
abandonJourney(uniqueId) {
|
|
3970
|
+
return from(this.ensureConfigured().userJourneys.abandon(uniqueId));
|
|
3971
|
+
}
|
|
3972
|
+
getJourneysByUser(userUniqueId) {
|
|
3973
|
+
return from(this.ensureConfigured().userJourneys.getByUser(userUniqueId));
|
|
3974
|
+
}
|
|
3975
|
+
getJourneyProgress(uniqueId) {
|
|
3976
|
+
return from(this.ensureConfigured().userJourneys.getProgress(uniqueId));
|
|
3977
|
+
}
|
|
3978
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3979
|
+
// User Identities Service
|
|
3980
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3981
|
+
listUserIdentities(params) {
|
|
3982
|
+
return from(this.ensureConfigured().userIdentities.list(params));
|
|
3983
|
+
}
|
|
3984
|
+
getUserIdentity(uniqueId) {
|
|
3985
|
+
return from(this.ensureConfigured().userIdentities.get(uniqueId));
|
|
3986
|
+
}
|
|
3987
|
+
createUserIdentity(request) {
|
|
3988
|
+
return from(this.ensureConfigured().userIdentities.create(request));
|
|
3989
|
+
}
|
|
3990
|
+
verifyUserIdentity(uniqueId, request) {
|
|
3991
|
+
return from(this.ensureConfigured().userIdentities.verify(uniqueId, request));
|
|
3992
|
+
}
|
|
3993
|
+
deleteUserIdentity(uniqueId) {
|
|
3994
|
+
return from(this.ensureConfigured().userIdentities.delete(uniqueId));
|
|
3995
|
+
}
|
|
3996
|
+
listIdentitiesByUser(userUniqueId) {
|
|
3997
|
+
return from(this.ensureConfigured().userIdentities.listByUser(userUniqueId));
|
|
3998
|
+
}
|
|
3999
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4000
|
+
// Direct Block Access (for advanced usage)
|
|
4001
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4002
|
+
/**
|
|
4003
|
+
* Access the underlying block for advanced operations
|
|
4004
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
4005
|
+
*/ get rawBlock() {
|
|
4006
|
+
return this.ensureConfigured();
|
|
4007
|
+
}
|
|
4008
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
4009
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
4010
|
+
this.block = transport ? createOnboardingBlock(transport, config) : null;
|
|
4011
|
+
}
|
|
4012
|
+
}, _classThis = _class, (()=>{
|
|
4013
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
4014
|
+
__esDecorate(null, _classDescriptor = {
|
|
4015
|
+
value: _classThis
|
|
4016
|
+
}, _classDecorators, {
|
|
4017
|
+
kind: "class",
|
|
4018
|
+
name: _classThis.name,
|
|
4019
|
+
metadata: _metadata
|
|
4020
|
+
}, null, _classExtraInitializers);
|
|
4021
|
+
_classThis = _classDescriptor.value;
|
|
4022
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
4023
|
+
enumerable: true,
|
|
4024
|
+
configurable: true,
|
|
4025
|
+
writable: true,
|
|
4026
|
+
value: _metadata
|
|
4027
|
+
});
|
|
4028
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
4029
|
+
})(), _class);
|
|
4030
|
+
return _classThis;
|
|
4031
|
+
})();
|
|
4032
|
+
|
|
4033
|
+
/**
|
|
4034
|
+
* Angular service wrapping the University block.
|
|
4035
|
+
* Converts Promise-based APIs to RxJS Observables.
|
|
4036
|
+
*
|
|
4037
|
+
* @example
|
|
4038
|
+
* ```typescript
|
|
4039
|
+
* @Component({...})
|
|
4040
|
+
* export class CourseListComponent {
|
|
4041
|
+
* constructor(private university: UniversityService) {}
|
|
4042
|
+
*
|
|
4043
|
+
* loadCourses() {
|
|
4044
|
+
* this.university.listCourses({ page: 1, perPage: 10 }).subscribe({
|
|
4045
|
+
* next: (result) => console.log('Courses:', result.data),
|
|
4046
|
+
* error: (err) => console.error('Failed:', err),
|
|
4047
|
+
* });
|
|
4048
|
+
* }
|
|
4049
|
+
* }
|
|
4050
|
+
* ```
|
|
4051
|
+
*/ let UniversityService = (()=>{
|
|
4052
|
+
var _class;
|
|
4053
|
+
let _classDecorators = [
|
|
4054
|
+
Injectable({
|
|
4055
|
+
providedIn: 'root'
|
|
4056
|
+
})
|
|
4057
|
+
];
|
|
4058
|
+
let _classDescriptor;
|
|
4059
|
+
let _classExtraInitializers = [];
|
|
4060
|
+
let _classThis;
|
|
4061
|
+
(_class = class {
|
|
4062
|
+
/**
|
|
4063
|
+
* Ensure the service is configured, throw helpful error if not
|
|
4064
|
+
*/ ensureConfigured() {
|
|
4065
|
+
if (!this.block) {
|
|
4066
|
+
throw new Error('[23blocks] UniversityService is not configured. ' + "Add 'urls.university' to your provideBlocks23() configuration.");
|
|
4067
|
+
}
|
|
4068
|
+
return this.block;
|
|
4069
|
+
}
|
|
4070
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4071
|
+
// Courses Service
|
|
4072
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4073
|
+
listCourses(params) {
|
|
4074
|
+
return from(this.ensureConfigured().courses.list(params));
|
|
4075
|
+
}
|
|
4076
|
+
getCourse(uniqueId) {
|
|
4077
|
+
return from(this.ensureConfigured().courses.get(uniqueId));
|
|
4078
|
+
}
|
|
4079
|
+
createCourse(data) {
|
|
4080
|
+
return from(this.ensureConfigured().courses.create(data));
|
|
4081
|
+
}
|
|
4082
|
+
updateCourse(uniqueId, data) {
|
|
4083
|
+
return from(this.ensureConfigured().courses.update(uniqueId, data));
|
|
4084
|
+
}
|
|
4085
|
+
deleteCourse(uniqueId) {
|
|
4086
|
+
return from(this.ensureConfigured().courses.delete(uniqueId));
|
|
4087
|
+
}
|
|
4088
|
+
publishCourse(uniqueId) {
|
|
4089
|
+
return from(this.ensureConfigured().courses.publish(uniqueId));
|
|
4090
|
+
}
|
|
4091
|
+
unpublishCourse(uniqueId) {
|
|
4092
|
+
return from(this.ensureConfigured().courses.unpublish(uniqueId));
|
|
4093
|
+
}
|
|
4094
|
+
listCoursesByInstructor(instructorUniqueId, params) {
|
|
4095
|
+
return from(this.ensureConfigured().courses.listByInstructor(instructorUniqueId, params));
|
|
4096
|
+
}
|
|
4097
|
+
listCoursesByCategory(categoryUniqueId, params) {
|
|
4098
|
+
return from(this.ensureConfigured().courses.listByCategory(categoryUniqueId, params));
|
|
4099
|
+
}
|
|
4100
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4101
|
+
// Lessons Service
|
|
4102
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4103
|
+
listLessons(params) {
|
|
4104
|
+
return from(this.ensureConfigured().lessons.list(params));
|
|
4105
|
+
}
|
|
4106
|
+
getLesson(uniqueId) {
|
|
4107
|
+
return from(this.ensureConfigured().lessons.get(uniqueId));
|
|
4108
|
+
}
|
|
4109
|
+
createLesson(data) {
|
|
4110
|
+
return from(this.ensureConfigured().lessons.create(data));
|
|
4111
|
+
}
|
|
4112
|
+
updateLesson(uniqueId, data) {
|
|
4113
|
+
return from(this.ensureConfigured().lessons.update(uniqueId, data));
|
|
4114
|
+
}
|
|
4115
|
+
deleteLesson(uniqueId) {
|
|
4116
|
+
return from(this.ensureConfigured().lessons.delete(uniqueId));
|
|
4117
|
+
}
|
|
4118
|
+
reorderLessons(courseUniqueId, data) {
|
|
4119
|
+
return from(this.ensureConfigured().lessons.reorder(courseUniqueId, data));
|
|
4120
|
+
}
|
|
4121
|
+
listLessonsByCourse(courseUniqueId, params) {
|
|
4122
|
+
return from(this.ensureConfigured().lessons.listByCourse(courseUniqueId, params));
|
|
4123
|
+
}
|
|
4124
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4125
|
+
// Enrollments Service
|
|
4126
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4127
|
+
listEnrollments(params) {
|
|
4128
|
+
return from(this.ensureConfigured().enrollments.list(params));
|
|
4129
|
+
}
|
|
4130
|
+
getEnrollment(uniqueId) {
|
|
4131
|
+
return from(this.ensureConfigured().enrollments.get(uniqueId));
|
|
4132
|
+
}
|
|
4133
|
+
enroll(data) {
|
|
4134
|
+
return from(this.ensureConfigured().enrollments.enroll(data));
|
|
4135
|
+
}
|
|
4136
|
+
updateEnrollmentProgress(uniqueId, data) {
|
|
4137
|
+
return from(this.ensureConfigured().enrollments.updateProgress(uniqueId, data));
|
|
4138
|
+
}
|
|
4139
|
+
completeEnrollment(uniqueId) {
|
|
4140
|
+
return from(this.ensureConfigured().enrollments.complete(uniqueId));
|
|
4141
|
+
}
|
|
4142
|
+
dropEnrollment(uniqueId) {
|
|
4143
|
+
return from(this.ensureConfigured().enrollments.drop(uniqueId));
|
|
4144
|
+
}
|
|
4145
|
+
listEnrollmentsByCourse(courseUniqueId, params) {
|
|
4146
|
+
return from(this.ensureConfigured().enrollments.listByCourse(courseUniqueId, params));
|
|
4147
|
+
}
|
|
4148
|
+
listEnrollmentsByUser(userUniqueId, params) {
|
|
4149
|
+
return from(this.ensureConfigured().enrollments.listByUser(userUniqueId, params));
|
|
4150
|
+
}
|
|
4151
|
+
getCertificate(uniqueId) {
|
|
4152
|
+
return from(this.ensureConfigured().enrollments.getCertificate(uniqueId));
|
|
4153
|
+
}
|
|
4154
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4155
|
+
// Assignments Service
|
|
4156
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4157
|
+
listAssignments(params) {
|
|
4158
|
+
return from(this.ensureConfigured().assignments.list(params));
|
|
4159
|
+
}
|
|
4160
|
+
getAssignment(uniqueId) {
|
|
4161
|
+
return from(this.ensureConfigured().assignments.get(uniqueId));
|
|
4162
|
+
}
|
|
4163
|
+
createAssignment(data) {
|
|
4164
|
+
return from(this.ensureConfigured().assignments.create(data));
|
|
4165
|
+
}
|
|
4166
|
+
updateAssignment(uniqueId, data) {
|
|
4167
|
+
return from(this.ensureConfigured().assignments.update(uniqueId, data));
|
|
4168
|
+
}
|
|
4169
|
+
deleteAssignment(uniqueId) {
|
|
4170
|
+
return from(this.ensureConfigured().assignments.delete(uniqueId));
|
|
4171
|
+
}
|
|
4172
|
+
listAssignmentsByLesson(lessonUniqueId, params) {
|
|
4173
|
+
return from(this.ensureConfigured().assignments.listByLesson(lessonUniqueId, params));
|
|
4174
|
+
}
|
|
4175
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4176
|
+
// Submissions Service
|
|
4177
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4178
|
+
listSubmissions(params) {
|
|
4179
|
+
return from(this.ensureConfigured().submissions.list(params));
|
|
4180
|
+
}
|
|
4181
|
+
getSubmission(uniqueId) {
|
|
4182
|
+
return from(this.ensureConfigured().submissions.get(uniqueId));
|
|
4183
|
+
}
|
|
4184
|
+
submitAssignment(data) {
|
|
4185
|
+
return from(this.ensureConfigured().submissions.submit(data));
|
|
4186
|
+
}
|
|
4187
|
+
gradeSubmission(uniqueId, data) {
|
|
4188
|
+
return from(this.ensureConfigured().submissions.grade(uniqueId, data));
|
|
4189
|
+
}
|
|
4190
|
+
listSubmissionsByAssignment(assignmentUniqueId, params) {
|
|
4191
|
+
return from(this.ensureConfigured().submissions.listByAssignment(assignmentUniqueId, params));
|
|
4192
|
+
}
|
|
4193
|
+
listSubmissionsByUser(userUniqueId, params) {
|
|
4194
|
+
return from(this.ensureConfigured().submissions.listByUser(userUniqueId, params));
|
|
4195
|
+
}
|
|
4196
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4197
|
+
// Direct Block Access (for advanced usage)
|
|
4198
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4199
|
+
/**
|
|
4200
|
+
* Access the underlying block for advanced operations
|
|
4201
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
4202
|
+
*/ get rawBlock() {
|
|
4203
|
+
return this.ensureConfigured();
|
|
4204
|
+
}
|
|
4205
|
+
constructor(serviceTransport, legacyTransport, config){
|
|
4206
|
+
const transport = serviceTransport != null ? serviceTransport : legacyTransport;
|
|
4207
|
+
this.block = transport ? createUniversityBlock(transport, config) : null;
|
|
4208
|
+
}
|
|
4209
|
+
}, _classThis = _class, (()=>{
|
|
4210
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
4211
|
+
__esDecorate(null, _classDescriptor = {
|
|
4212
|
+
value: _classThis
|
|
4213
|
+
}, _classDecorators, {
|
|
4214
|
+
kind: "class",
|
|
4215
|
+
name: _classThis.name,
|
|
4216
|
+
metadata: _metadata
|
|
4217
|
+
}, null, _classExtraInitializers);
|
|
4218
|
+
_classThis = _classDescriptor.value;
|
|
4219
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, {
|
|
4220
|
+
enumerable: true,
|
|
4221
|
+
configurable: true,
|
|
4222
|
+
writable: true,
|
|
4223
|
+
value: _metadata
|
|
4224
|
+
});
|
|
4225
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
4226
|
+
})(), _class);
|
|
4227
|
+
return _classThis;
|
|
4228
|
+
})();
|
|
4229
|
+
|
|
4230
|
+
export { ASSETS_CONFIG, ASSETS_TRANSPORT, AUTHENTICATION_CONFIG, AUTHENTICATION_TRANSPORT, AssetsService, AuthenticationService, CAMPAIGNS_CONFIG, CAMPAIGNS_TRANSPORT, COMPANY_CONFIG, COMPANY_TRANSPORT, CONTENT_CONFIG, CONTENT_TRANSPORT, CONVERSATIONS_CONFIG, CONVERSATIONS_TRANSPORT, CRM_CONFIG, CRM_TRANSPORT, CampaignsService, CompanyService, ContentService, ConversationsService, CrmService, FILES_CONFIG, FILES_TRANSPORT, FORMS_CONFIG, FORMS_TRANSPORT, FilesService, FormsService, GEOLOCATION_CONFIG, GEOLOCATION_TRANSPORT, GeolocationService, JARVIS_CONFIG, JARVIS_TRANSPORT, JarvisService, ONBOARDING_CONFIG, ONBOARDING_TRANSPORT, OnboardingService, PRODUCTS_CONFIG, PRODUCTS_TRANSPORT, PROVIDER_CONFIG, ProductsService, REWARDS_CONFIG, REWARDS_TRANSPORT, RewardsService, SALES_CONFIG, SALES_TRANSPORT, SEARCH_CONFIG, SEARCH_TRANSPORT, SIMPLE_CONFIG, SalesService, SearchService, TOKEN_MANAGER, TRANSPORT, UNIVERSITY_CONFIG, UNIVERSITY_TRANSPORT, UniversityService, WALLET_CONFIG, WALLET_TRANSPORT, WalletService, get23BlocksProviders, getBlocks23Providers, provide23Blocks, provideBlocks23 };
|