@23blocks/angular 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/assets/assets.service.js +110 -0
- package/dist/lib/assets/assets.service.js.map +1 -0
- package/dist/lib/assets/index.js +3 -0
- package/dist/lib/assets/index.js.map +1 -0
- package/dist/lib/campaigns/campaigns.service.js +137 -0
- package/dist/lib/campaigns/campaigns.service.js.map +1 -0
- package/dist/lib/campaigns/index.js +3 -0
- package/dist/lib/campaigns/index.js.map +1 -0
- package/dist/lib/company/company.service.js +137 -0
- package/dist/lib/company/company.service.js.map +1 -0
- package/dist/lib/company/index.js +3 -0
- package/dist/lib/company/index.js.map +1 -0
- package/dist/lib/content/content.service.js +140 -0
- package/dist/lib/content/content.service.js.map +1 -0
- package/dist/lib/content/index.js +3 -0
- package/dist/lib/content/index.js.map +1 -0
- package/dist/lib/conversations/conversations.service.js +164 -0
- package/dist/lib/conversations/conversations.service.js.map +1 -0
- package/dist/lib/conversations/index.js +3 -0
- package/dist/lib/conversations/index.js.map +1 -0
- package/dist/lib/crm/crm.service.js +197 -0
- package/dist/lib/crm/crm.service.js.map +1 -0
- package/dist/lib/crm/index.js +3 -0
- package/dist/lib/crm/index.js.map +1 -0
- package/dist/lib/files/files.service.js +107 -0
- package/dist/lib/files/files.service.js.map +1 -0
- package/dist/lib/files/index.js +3 -0
- package/dist/lib/files/index.js.map +1 -0
- package/dist/lib/forms/forms.service.js +119 -0
- package/dist/lib/forms/forms.service.js.map +1 -0
- package/dist/lib/forms/index.js +3 -0
- package/dist/lib/forms/index.js.map +1 -0
- package/dist/lib/geolocation/geolocation.service.js +227 -0
- package/dist/lib/geolocation/geolocation.service.js.map +1 -0
- package/dist/lib/geolocation/index.js +3 -0
- package/dist/lib/geolocation/index.js.map +1 -0
- package/dist/lib/index.js +17 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/jarvis/index.js +3 -0
- package/dist/lib/jarvis/index.js.map +1 -0
- package/dist/lib/jarvis/jarvis.service.js +149 -0
- package/dist/lib/jarvis/jarvis.service.js.map +1 -0
- package/dist/lib/onboarding/index.js +3 -0
- package/dist/lib/onboarding/index.js.map +1 -0
- package/dist/lib/onboarding/onboarding.service.js +119 -0
- package/dist/lib/onboarding/onboarding.service.js.map +1 -0
- package/dist/lib/products/index.js +3 -0
- package/dist/lib/products/index.js.map +1 -0
- package/dist/lib/products/products.service.js +242 -0
- package/dist/lib/products/products.service.js.map +1 -0
- package/dist/lib/providers.js +195 -1
- package/dist/lib/providers.js.map +1 -1
- package/dist/lib/rewards/index.js +3 -0
- package/dist/lib/rewards/index.js.map +1 -0
- package/dist/lib/rewards/rewards.service.js +125 -0
- package/dist/lib/rewards/rewards.service.js.map +1 -0
- package/dist/lib/sales/index.js +3 -0
- package/dist/lib/sales/index.js.map +1 -0
- package/dist/lib/sales/sales.service.js +125 -0
- package/dist/lib/sales/sales.service.js.map +1 -0
- package/dist/lib/tokens.js +48 -0
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/university/index.js +3 -0
- package/dist/lib/university/index.js.map +1 -0
- package/dist/lib/university/university.service.js +161 -0
- package/dist/lib/university/university.service.js.map +1 -0
- package/dist/lib/wallet/index.js +3 -0
- package/dist/lib/wallet/index.js.map +1 -0
- package/dist/lib/wallet/wallet.service.js +98 -0
- package/dist/lib/wallet/wallet.service.js.map +1 -0
- package/package.json +19 -3
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { _ as _ts_metadata } from "@swc/helpers/_/_ts_metadata";
|
|
3
|
+
import { _ as _ts_param } from "@swc/helpers/_/_ts_param";
|
|
4
|
+
import { Injectable, Inject } from '@angular/core';
|
|
5
|
+
import { from } from 'rxjs';
|
|
6
|
+
import { createJarvisBlock } from '@23blocks/block-jarvis';
|
|
7
|
+
import { TRANSPORT, JARVIS_CONFIG } from '../tokens.js';
|
|
8
|
+
export class JarvisService {
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
// Agents Service
|
|
11
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
+
listAgents(params) {
|
|
13
|
+
return from(this.block.agents.list(params));
|
|
14
|
+
}
|
|
15
|
+
getAgent(uniqueId) {
|
|
16
|
+
return from(this.block.agents.get(uniqueId));
|
|
17
|
+
}
|
|
18
|
+
createAgent(data) {
|
|
19
|
+
return from(this.block.agents.create(data));
|
|
20
|
+
}
|
|
21
|
+
updateAgent(uniqueId, data) {
|
|
22
|
+
return from(this.block.agents.update(uniqueId, data));
|
|
23
|
+
}
|
|
24
|
+
deleteAgent(uniqueId) {
|
|
25
|
+
return from(this.block.agents.delete(uniqueId));
|
|
26
|
+
}
|
|
27
|
+
chat(uniqueId, data) {
|
|
28
|
+
return from(this.block.agents.chat(uniqueId, data));
|
|
29
|
+
}
|
|
30
|
+
complete(uniqueId, data) {
|
|
31
|
+
return from(this.block.agents.complete(uniqueId, data));
|
|
32
|
+
}
|
|
33
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
34
|
+
// Prompts Service
|
|
35
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
36
|
+
listPrompts(params) {
|
|
37
|
+
return from(this.block.prompts.list(params));
|
|
38
|
+
}
|
|
39
|
+
getPrompt(uniqueId) {
|
|
40
|
+
return from(this.block.prompts.get(uniqueId));
|
|
41
|
+
}
|
|
42
|
+
createPrompt(data) {
|
|
43
|
+
return from(this.block.prompts.create(data));
|
|
44
|
+
}
|
|
45
|
+
updatePrompt(uniqueId, data) {
|
|
46
|
+
return from(this.block.prompts.update(uniqueId, data));
|
|
47
|
+
}
|
|
48
|
+
deletePrompt(uniqueId) {
|
|
49
|
+
return from(this.block.prompts.delete(uniqueId));
|
|
50
|
+
}
|
|
51
|
+
executePrompt(uniqueId, data) {
|
|
52
|
+
return from(this.block.prompts.execute(uniqueId, data));
|
|
53
|
+
}
|
|
54
|
+
testPrompt(data) {
|
|
55
|
+
return from(this.block.prompts.test(data));
|
|
56
|
+
}
|
|
57
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
58
|
+
// Workflows Service
|
|
59
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
60
|
+
listWorkflows(params) {
|
|
61
|
+
return from(this.block.workflows.list(params));
|
|
62
|
+
}
|
|
63
|
+
getWorkflow(uniqueId) {
|
|
64
|
+
return from(this.block.workflows.get(uniqueId));
|
|
65
|
+
}
|
|
66
|
+
createWorkflow(data) {
|
|
67
|
+
return from(this.block.workflows.create(data));
|
|
68
|
+
}
|
|
69
|
+
updateWorkflow(uniqueId, data) {
|
|
70
|
+
return from(this.block.workflows.update(uniqueId, data));
|
|
71
|
+
}
|
|
72
|
+
deleteWorkflow(uniqueId) {
|
|
73
|
+
return from(this.block.workflows.delete(uniqueId));
|
|
74
|
+
}
|
|
75
|
+
runWorkflow(uniqueId, data) {
|
|
76
|
+
return from(this.block.workflows.run(uniqueId, data));
|
|
77
|
+
}
|
|
78
|
+
pauseWorkflow(uniqueId) {
|
|
79
|
+
return from(this.block.workflows.pause(uniqueId));
|
|
80
|
+
}
|
|
81
|
+
resumeWorkflow(uniqueId) {
|
|
82
|
+
return from(this.block.workflows.resume(uniqueId));
|
|
83
|
+
}
|
|
84
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
85
|
+
// Executions Service
|
|
86
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
listExecutions(params) {
|
|
88
|
+
return from(this.block.executions.list(params));
|
|
89
|
+
}
|
|
90
|
+
getExecution(uniqueId) {
|
|
91
|
+
return from(this.block.executions.get(uniqueId));
|
|
92
|
+
}
|
|
93
|
+
listExecutionsByAgent(agentUniqueId, params) {
|
|
94
|
+
return from(this.block.executions.listByAgent(agentUniqueId, params));
|
|
95
|
+
}
|
|
96
|
+
listExecutionsByPrompt(promptUniqueId, params) {
|
|
97
|
+
return from(this.block.executions.listByPrompt(promptUniqueId, params));
|
|
98
|
+
}
|
|
99
|
+
cancelExecution(uniqueId) {
|
|
100
|
+
return from(this.block.executions.cancel(uniqueId));
|
|
101
|
+
}
|
|
102
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
103
|
+
// Conversations Service
|
|
104
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
105
|
+
listConversations(params) {
|
|
106
|
+
return from(this.block.conversations.list(params));
|
|
107
|
+
}
|
|
108
|
+
getConversation(uniqueId) {
|
|
109
|
+
return from(this.block.conversations.get(uniqueId));
|
|
110
|
+
}
|
|
111
|
+
createConversation(data) {
|
|
112
|
+
return from(this.block.conversations.create(data));
|
|
113
|
+
}
|
|
114
|
+
sendMessage(uniqueId, data) {
|
|
115
|
+
return from(this.block.conversations.sendMessage(uniqueId, data));
|
|
116
|
+
}
|
|
117
|
+
listConversationsByUser(userUniqueId, params) {
|
|
118
|
+
return from(this.block.conversations.listByUser(userUniqueId, params));
|
|
119
|
+
}
|
|
120
|
+
clearConversation(uniqueId) {
|
|
121
|
+
return from(this.block.conversations.clear(uniqueId));
|
|
122
|
+
}
|
|
123
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
124
|
+
// Direct Block Access (for advanced usage)
|
|
125
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
126
|
+
/**
|
|
127
|
+
* Access the underlying block for advanced operations
|
|
128
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
129
|
+
*/ get rawBlock() {
|
|
130
|
+
return this.block;
|
|
131
|
+
}
|
|
132
|
+
constructor(transport, config){
|
|
133
|
+
this.block = createJarvisBlock(transport, config);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
JarvisService = _ts_decorate([
|
|
137
|
+
Injectable({
|
|
138
|
+
providedIn: 'root'
|
|
139
|
+
}),
|
|
140
|
+
_ts_param(0, Inject(TRANSPORT)),
|
|
141
|
+
_ts_param(1, Inject(JARVIS_CONFIG)),
|
|
142
|
+
_ts_metadata("design:type", Function),
|
|
143
|
+
_ts_metadata("design:paramtypes", [
|
|
144
|
+
typeof Transport === "undefined" ? Object : Transport,
|
|
145
|
+
typeof JarvisBlockConfig === "undefined" ? Object : JarvisBlockConfig
|
|
146
|
+
])
|
|
147
|
+
], JarvisService);
|
|
148
|
+
|
|
149
|
+
//# sourceMappingURL=jarvis.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/jarvis/jarvis.service.ts"],"sourcesContent":["import { Injectable, Inject } from '@angular/core';\nimport { Observable, from } from 'rxjs';\nimport type { Transport, PageResult } from '@23blocks/contracts';\nimport {\n createJarvisBlock,\n type JarvisBlock,\n type JarvisBlockConfig,\n type Agent,\n type CreateAgentRequest,\n type UpdateAgentRequest,\n type ListAgentsParams,\n type ChatRequest,\n type ChatResponse,\n type CompleteRequest,\n type CompleteResponse,\n type Prompt,\n type CreatePromptRequest,\n type UpdatePromptRequest,\n type ListPromptsParams,\n type ExecutePromptRequest,\n type ExecutePromptResponse,\n type TestPromptRequest,\n type TestPromptResponse,\n type Workflow,\n type CreateWorkflowRequest,\n type UpdateWorkflowRequest,\n type ListWorkflowsParams,\n type RunWorkflowRequest,\n type RunWorkflowResponse,\n type Execution,\n type ListExecutionsParams,\n type Conversation,\n type CreateConversationRequest,\n type SendMessageRequest,\n type SendMessageResponse,\n type ListConversationsParams,\n} from '@23blocks/block-jarvis';\nimport { TRANSPORT, JARVIS_CONFIG } from '../tokens.js';\n\n/**\n * Angular service wrapping the Jarvis block.\n * Converts Promise-based APIs to RxJS Observables.\n *\n * @example\n * ```typescript\n * @Component({...})\n * export class ChatComponent {\n * constructor(private jarvis: JarvisService) {}\n *\n * sendMessage(agentId: string, message: string) {\n * this.jarvis.chat(agentId, { message }).subscribe({\n * next: (response) => console.log('Response:', response.response),\n * error: (err) => console.error('Failed:', err),\n * });\n * }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class JarvisService {\n private readonly block: JarvisBlock;\n\n constructor(\n @Inject(TRANSPORT) transport: Transport,\n @Inject(JARVIS_CONFIG) config: JarvisBlockConfig\n ) {\n this.block = createJarvisBlock(transport, config);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Agents Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listAgents(params?: ListAgentsParams): Observable<PageResult<Agent>> {\n return from(this.block.agents.list(params));\n }\n\n getAgent(uniqueId: string): Observable<Agent> {\n return from(this.block.agents.get(uniqueId));\n }\n\n createAgent(data: CreateAgentRequest): Observable<Agent> {\n return from(this.block.agents.create(data));\n }\n\n updateAgent(uniqueId: string, data: UpdateAgentRequest): Observable<Agent> {\n return from(this.block.agents.update(uniqueId, data));\n }\n\n deleteAgent(uniqueId: string): Observable<void> {\n return from(this.block.agents.delete(uniqueId));\n }\n\n chat(uniqueId: string, data: ChatRequest): Observable<ChatResponse> {\n return from(this.block.agents.chat(uniqueId, data));\n }\n\n complete(uniqueId: string, data: CompleteRequest): Observable<CompleteResponse> {\n return from(this.block.agents.complete(uniqueId, data));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Prompts Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listPrompts(params?: ListPromptsParams): Observable<PageResult<Prompt>> {\n return from(this.block.prompts.list(params));\n }\n\n getPrompt(uniqueId: string): Observable<Prompt> {\n return from(this.block.prompts.get(uniqueId));\n }\n\n createPrompt(data: CreatePromptRequest): Observable<Prompt> {\n return from(this.block.prompts.create(data));\n }\n\n updatePrompt(uniqueId: string, data: UpdatePromptRequest): Observable<Prompt> {\n return from(this.block.prompts.update(uniqueId, data));\n }\n\n deletePrompt(uniqueId: string): Observable<void> {\n return from(this.block.prompts.delete(uniqueId));\n }\n\n executePrompt(uniqueId: string, data: ExecutePromptRequest): Observable<ExecutePromptResponse> {\n return from(this.block.prompts.execute(uniqueId, data));\n }\n\n testPrompt(data: TestPromptRequest): Observable<TestPromptResponse> {\n return from(this.block.prompts.test(data));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Workflows Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listWorkflows(params?: ListWorkflowsParams): Observable<PageResult<Workflow>> {\n return from(this.block.workflows.list(params));\n }\n\n getWorkflow(uniqueId: string): Observable<Workflow> {\n return from(this.block.workflows.get(uniqueId));\n }\n\n createWorkflow(data: CreateWorkflowRequest): Observable<Workflow> {\n return from(this.block.workflows.create(data));\n }\n\n updateWorkflow(uniqueId: string, data: UpdateWorkflowRequest): Observable<Workflow> {\n return from(this.block.workflows.update(uniqueId, data));\n }\n\n deleteWorkflow(uniqueId: string): Observable<void> {\n return from(this.block.workflows.delete(uniqueId));\n }\n\n runWorkflow(uniqueId: string, data: RunWorkflowRequest): Observable<RunWorkflowResponse> {\n return from(this.block.workflows.run(uniqueId, data));\n }\n\n pauseWorkflow(uniqueId: string): Observable<Workflow> {\n return from(this.block.workflows.pause(uniqueId));\n }\n\n resumeWorkflow(uniqueId: string): Observable<Workflow> {\n return from(this.block.workflows.resume(uniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Executions Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listExecutions(params?: ListExecutionsParams): Observable<PageResult<Execution>> {\n return from(this.block.executions.list(params));\n }\n\n getExecution(uniqueId: string): Observable<Execution> {\n return from(this.block.executions.get(uniqueId));\n }\n\n listExecutionsByAgent(agentUniqueId: string, params?: ListExecutionsParams): Observable<PageResult<Execution>> {\n return from(this.block.executions.listByAgent(agentUniqueId, params));\n }\n\n listExecutionsByPrompt(promptUniqueId: string, params?: ListExecutionsParams): Observable<PageResult<Execution>> {\n return from(this.block.executions.listByPrompt(promptUniqueId, params));\n }\n\n cancelExecution(uniqueId: string): Observable<Execution> {\n return from(this.block.executions.cancel(uniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Conversations Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listConversations(params?: ListConversationsParams): Observable<PageResult<Conversation>> {\n return from(this.block.conversations.list(params));\n }\n\n getConversation(uniqueId: string): Observable<Conversation> {\n return from(this.block.conversations.get(uniqueId));\n }\n\n createConversation(data: CreateConversationRequest): Observable<Conversation> {\n return from(this.block.conversations.create(data));\n }\n\n sendMessage(uniqueId: string, data: SendMessageRequest): Observable<SendMessageResponse> {\n return from(this.block.conversations.sendMessage(uniqueId, data));\n }\n\n listConversationsByUser(userUniqueId: string, params?: ListConversationsParams): Observable<PageResult<Conversation>> {\n return from(this.block.conversations.listByUser(userUniqueId, params));\n }\n\n clearConversation(uniqueId: string): Observable<Conversation> {\n return from(this.block.conversations.clear(uniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Direct Block Access (for advanced usage)\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Access the underlying block for advanced operations\n * Use this when you need access to services not wrapped by this Angular service\n */\n get rawBlock(): JarvisBlock {\n return this.block;\n }\n}\n"],"names":["Injectable","Inject","from","createJarvisBlock","TRANSPORT","JARVIS_CONFIG","JarvisService","listAgents","params","block","agents","list","getAgent","uniqueId","get","createAgent","data","create","updateAgent","update","deleteAgent","delete","chat","complete","listPrompts","prompts","getPrompt","createPrompt","updatePrompt","deletePrompt","executePrompt","execute","testPrompt","test","listWorkflows","workflows","getWorkflow","createWorkflow","updateWorkflow","deleteWorkflow","runWorkflow","run","pauseWorkflow","pause","resumeWorkflow","resume","listExecutions","executions","getExecution","listExecutionsByAgent","agentUniqueId","listByAgent","listExecutionsByPrompt","promptUniqueId","listByPrompt","cancelExecution","cancel","listConversations","conversations","getConversation","createConversation","sendMessage","listConversationsByUser","userUniqueId","listByUser","clearConversation","clear","rawBlock","constructor","transport","config","providedIn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;AAAA,SAASA,UAAU,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AmB5C,IAA+B,EAA4B;QAC5E,OAAOd,KAAK,IAAI,CAACO,KAAK,CAACiD,aAAa,CAACzC,MAAM,CAACD;IAC9C;IAEA6C,YAAYhD,QAAgB,EAAEG,IAAwB,EAAmC;QACvF,OAAOd,KAAK,IAAI,CAACO,KAAK,CAACiD,aAAa,CAACG,WAAW,CAAChD,UAAUG;IAC7D;IAEA8C,wBAAwBC,YAAoB,EAAEvD,MAAgC,EAAwC;QACpH,OAAON,KAAK,IAAI,CAACO,KAAK,CAACiD,aAAa,CAACM,UAAU,CAACD,cAAcvD;IAChE;IAEAyD,kBAAkBpD,QAAgB,EAA4B;QAC5D,OAAOX,KAAK,IAAI,CAACO,KAAK,CAACiD,aAAa,CAACQ,KAAK,CAACrD;IAC7C;IAEA,gFAAgF;IAChF,2CAA2C;IAC3C,gFAAgF;IAEhF;;;GAGC,GACD,IAAIsD,WAAwB;QAC1B,OAAO,IAAI,CAAC1D,KAAK;IACnB;IAzKA2D,YACE,AAAmBC,SAAoB,EACvC,AAAuBC,MAAyB,CAChD;QACA,IAAI,CAAC7D,KAAK,GAAGN,kBAAkBkE,WAAWC;IAC5C;AAqKF;AA7KahE;IADZN,WAAW;QAAEuE,YAAY;IAAO;IAK5BtE,aAAAA,OAAOG;IACPH,aAAAA,OAAOI;;;eADsB,qCAAA;eACC,6CAAA;;GALtBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/onboarding/index.ts"],"sourcesContent":["export { OnboardingService } from './onboarding.service';\n"],"names":["OnboardingService"],"rangeMappings":"","mappings":"AAAA,SAASA,iBAAiB,QAAQ,uBAAuB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { _ as _ts_metadata } from "@swc/helpers/_/_ts_metadata";
|
|
3
|
+
import { _ as _ts_param } from "@swc/helpers/_/_ts_param";
|
|
4
|
+
import { Injectable, Inject } from '@angular/core';
|
|
5
|
+
import { from } from 'rxjs';
|
|
6
|
+
import { createOnboardingBlock } from '@23blocks/block-onboarding';
|
|
7
|
+
import { TRANSPORT, ONBOARDING_CONFIG } from '../tokens.js';
|
|
8
|
+
export class OnboardingService {
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
// Onboardings Service
|
|
11
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
+
listOnboardings(params) {
|
|
13
|
+
return from(this.block.onboardings.list(params));
|
|
14
|
+
}
|
|
15
|
+
getOnboarding(uniqueId) {
|
|
16
|
+
return from(this.block.onboardings.get(uniqueId));
|
|
17
|
+
}
|
|
18
|
+
createOnboarding(request) {
|
|
19
|
+
return from(this.block.onboardings.create(request));
|
|
20
|
+
}
|
|
21
|
+
updateOnboarding(uniqueId, request) {
|
|
22
|
+
return from(this.block.onboardings.update(uniqueId, request));
|
|
23
|
+
}
|
|
24
|
+
deleteOnboarding(uniqueId) {
|
|
25
|
+
return from(this.block.onboardings.delete(uniqueId));
|
|
26
|
+
}
|
|
27
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
28
|
+
// Flows Service
|
|
29
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
30
|
+
listFlows(params) {
|
|
31
|
+
return from(this.block.flows.list(params));
|
|
32
|
+
}
|
|
33
|
+
getFlow(uniqueId) {
|
|
34
|
+
return from(this.block.flows.get(uniqueId));
|
|
35
|
+
}
|
|
36
|
+
createFlow(request) {
|
|
37
|
+
return from(this.block.flows.create(request));
|
|
38
|
+
}
|
|
39
|
+
updateFlow(uniqueId, request) {
|
|
40
|
+
return from(this.block.flows.update(uniqueId, request));
|
|
41
|
+
}
|
|
42
|
+
deleteFlow(uniqueId) {
|
|
43
|
+
return from(this.block.flows.delete(uniqueId));
|
|
44
|
+
}
|
|
45
|
+
listFlowsByOnboarding(onboardingUniqueId) {
|
|
46
|
+
return from(this.block.flows.listByOnboarding(onboardingUniqueId));
|
|
47
|
+
}
|
|
48
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
49
|
+
// User Journeys Service
|
|
50
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
51
|
+
listUserJourneys(params) {
|
|
52
|
+
return from(this.block.userJourneys.list(params));
|
|
53
|
+
}
|
|
54
|
+
getUserJourney(uniqueId) {
|
|
55
|
+
return from(this.block.userJourneys.get(uniqueId));
|
|
56
|
+
}
|
|
57
|
+
startJourney(request) {
|
|
58
|
+
return from(this.block.userJourneys.start(request));
|
|
59
|
+
}
|
|
60
|
+
completeStep(uniqueId, request) {
|
|
61
|
+
return from(this.block.userJourneys.completeStep(uniqueId, request));
|
|
62
|
+
}
|
|
63
|
+
abandonJourney(uniqueId) {
|
|
64
|
+
return from(this.block.userJourneys.abandon(uniqueId));
|
|
65
|
+
}
|
|
66
|
+
getJourneysByUser(userUniqueId) {
|
|
67
|
+
return from(this.block.userJourneys.getByUser(userUniqueId));
|
|
68
|
+
}
|
|
69
|
+
getJourneyProgress(uniqueId) {
|
|
70
|
+
return from(this.block.userJourneys.getProgress(uniqueId));
|
|
71
|
+
}
|
|
72
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
73
|
+
// User Identities Service
|
|
74
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
75
|
+
listUserIdentities(params) {
|
|
76
|
+
return from(this.block.userIdentities.list(params));
|
|
77
|
+
}
|
|
78
|
+
getUserIdentity(uniqueId) {
|
|
79
|
+
return from(this.block.userIdentities.get(uniqueId));
|
|
80
|
+
}
|
|
81
|
+
createUserIdentity(request) {
|
|
82
|
+
return from(this.block.userIdentities.create(request));
|
|
83
|
+
}
|
|
84
|
+
verifyUserIdentity(uniqueId, request) {
|
|
85
|
+
return from(this.block.userIdentities.verify(uniqueId, request));
|
|
86
|
+
}
|
|
87
|
+
deleteUserIdentity(uniqueId) {
|
|
88
|
+
return from(this.block.userIdentities.delete(uniqueId));
|
|
89
|
+
}
|
|
90
|
+
listIdentitiesByUser(userUniqueId) {
|
|
91
|
+
return from(this.block.userIdentities.listByUser(userUniqueId));
|
|
92
|
+
}
|
|
93
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
94
|
+
// Direct Block Access (for advanced usage)
|
|
95
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
96
|
+
/**
|
|
97
|
+
* Access the underlying block for advanced operations
|
|
98
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
99
|
+
*/ get rawBlock() {
|
|
100
|
+
return this.block;
|
|
101
|
+
}
|
|
102
|
+
constructor(transport, config){
|
|
103
|
+
this.block = createOnboardingBlock(transport, config);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
OnboardingService = _ts_decorate([
|
|
107
|
+
Injectable({
|
|
108
|
+
providedIn: 'root'
|
|
109
|
+
}),
|
|
110
|
+
_ts_param(0, Inject(TRANSPORT)),
|
|
111
|
+
_ts_param(1, Inject(ONBOARDING_CONFIG)),
|
|
112
|
+
_ts_metadata("design:type", Function),
|
|
113
|
+
_ts_metadata("design:paramtypes", [
|
|
114
|
+
typeof Transport === "undefined" ? Object : Transport,
|
|
115
|
+
typeof OnboardingBlockConfig === "undefined" ? Object : OnboardingBlockConfig
|
|
116
|
+
])
|
|
117
|
+
], OnboardingService);
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=onboarding.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/onboarding/onboarding.service.ts"],"sourcesContent":["import { Injectable, Inject } from '@angular/core';\nimport { Observable, from } from 'rxjs';\nimport type { Transport, PageResult } from '@23blocks/contracts';\nimport {\n createOnboardingBlock,\n type OnboardingBlock,\n type OnboardingBlockConfig,\n type Onboarding,\n type CreateOnboardingRequest,\n type UpdateOnboardingRequest,\n type ListOnboardingsParams,\n type Flow,\n type CreateFlowRequest,\n type UpdateFlowRequest,\n type ListFlowsParams,\n type UserJourney,\n type StartJourneyRequest,\n type CompleteStepRequest,\n type ListUserJourneysParams,\n type UserIdentity,\n type CreateUserIdentityRequest,\n type VerifyUserIdentityRequest,\n type ListUserIdentitiesParams,\n} from '@23blocks/block-onboarding';\nimport { TRANSPORT, ONBOARDING_CONFIG } from '../tokens.js';\n\n/**\n * Angular service wrapping the Onboarding block.\n * Converts Promise-based APIs to RxJS Observables.\n *\n * @example\n * ```typescript\n * @Component({...})\n * export class OnboardingComponent {\n * constructor(private onboarding: OnboardingService) {}\n *\n * createOnboarding() {\n * this.onboarding.createOnboarding({\n * code: 'user-onboarding',\n * name: 'User Onboarding',\n * steps: []\n * }).subscribe({\n * next: (onboarding) => console.log('Created:', onboarding),\n * error: (err) => console.error('Failed:', err),\n * });\n * }\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class OnboardingService {\n private readonly block: OnboardingBlock;\n\n constructor(\n @Inject(TRANSPORT) transport: Transport,\n @Inject(ONBOARDING_CONFIG) config: OnboardingBlockConfig\n ) {\n this.block = createOnboardingBlock(transport, config);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Onboardings Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listOnboardings(params?: ListOnboardingsParams): Observable<PageResult<Onboarding>> {\n return from(this.block.onboardings.list(params));\n }\n\n getOnboarding(uniqueId: string): Observable<Onboarding> {\n return from(this.block.onboardings.get(uniqueId));\n }\n\n createOnboarding(request: CreateOnboardingRequest): Observable<Onboarding> {\n return from(this.block.onboardings.create(request));\n }\n\n updateOnboarding(uniqueId: string, request: UpdateOnboardingRequest): Observable<Onboarding> {\n return from(this.block.onboardings.update(uniqueId, request));\n }\n\n deleteOnboarding(uniqueId: string): Observable<void> {\n return from(this.block.onboardings.delete(uniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Flows Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listFlows(params?: ListFlowsParams): Observable<PageResult<Flow>> {\n return from(this.block.flows.list(params));\n }\n\n getFlow(uniqueId: string): Observable<Flow> {\n return from(this.block.flows.get(uniqueId));\n }\n\n createFlow(request: CreateFlowRequest): Observable<Flow> {\n return from(this.block.flows.create(request));\n }\n\n updateFlow(uniqueId: string, request: UpdateFlowRequest): Observable<Flow> {\n return from(this.block.flows.update(uniqueId, request));\n }\n\n deleteFlow(uniqueId: string): Observable<void> {\n return from(this.block.flows.delete(uniqueId));\n }\n\n listFlowsByOnboarding(onboardingUniqueId: string): Observable<Flow[]> {\n return from(this.block.flows.listByOnboarding(onboardingUniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // User Journeys Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listUserJourneys(params?: ListUserJourneysParams): Observable<PageResult<UserJourney>> {\n return from(this.block.userJourneys.list(params));\n }\n\n getUserJourney(uniqueId: string): Observable<UserJourney> {\n return from(this.block.userJourneys.get(uniqueId));\n }\n\n startJourney(request: StartJourneyRequest): Observable<UserJourney> {\n return from(this.block.userJourneys.start(request));\n }\n\n completeStep(uniqueId: string, request: CompleteStepRequest): Observable<UserJourney> {\n return from(this.block.userJourneys.completeStep(uniqueId, request));\n }\n\n abandonJourney(uniqueId: string): Observable<UserJourney> {\n return from(this.block.userJourneys.abandon(uniqueId));\n }\n\n getJourneysByUser(userUniqueId: string): Observable<UserJourney[]> {\n return from(this.block.userJourneys.getByUser(userUniqueId));\n }\n\n getJourneyProgress(uniqueId: string): Observable<{ progress: number; currentStep?: number; completedSteps?: number[] }> {\n return from(this.block.userJourneys.getProgress(uniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // User Identities Service\n // ─────────────────────────────────────────────────────────────────────────────\n\n listUserIdentities(params?: ListUserIdentitiesParams): Observable<PageResult<UserIdentity>> {\n return from(this.block.userIdentities.list(params));\n }\n\n getUserIdentity(uniqueId: string): Observable<UserIdentity> {\n return from(this.block.userIdentities.get(uniqueId));\n }\n\n createUserIdentity(request: CreateUserIdentityRequest): Observable<UserIdentity> {\n return from(this.block.userIdentities.create(request));\n }\n\n verifyUserIdentity(uniqueId: string, request: VerifyUserIdentityRequest): Observable<UserIdentity> {\n return from(this.block.userIdentities.verify(uniqueId, request));\n }\n\n deleteUserIdentity(uniqueId: string): Observable<void> {\n return from(this.block.userIdentities.delete(uniqueId));\n }\n\n listIdentitiesByUser(userUniqueId: string): Observable<UserIdentity[]> {\n return from(this.block.userIdentities.listByUser(userUniqueId));\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Direct Block Access (for advanced usage)\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Access the underlying block for advanced operations\n * Use this when you need access to services not wrapped by this Angular service\n */\n get rawBlock(): OnboardingBlock {\n return this.block;\n }\n}\n"],"names":["Injectable","Inject","from","createOnboardingBlock","TRANSPORT","ONBOARDING_CONFIG","OnboardingService","listOnboardings","params","block","onboardings","list","getOnboarding","uniqueId","get","createOnboarding","request","create","updateOnboarding","update","deleteOnboarding","delete","listFlows","flows","getFlow","createFlow","updateFlow","deleteFlow","listFlowsByOnboarding","onboardingUniqueId","listByOnboarding","listUserJourneys","userJourneys","getUserJourney","startJourney","start","completeStep","abandonJourney","abandon","getJourneysByUser","userUniqueId","getByUser","getJourneyProgress","getProgress","listUserIdentities","userIdentities","getUserIdentity","createUserIdentity","verifyUserIdentity","verify","deleteUserIdentity","listIdentitiesByUser","listByUser","rawBlock","constructor","transport","config","providedIn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;AAAA,SAASA,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACnD,SAAqBC,IAAI,QAAQ,OAAO;AAExC,SACEC,qBAAqB,QAmBhB,6BAA6B;AACpC,SAASC,SAAS,EAAEC,iBAAiB,QAAQ,eAAe;AA0B5D,OAAO,MAAMC;IAUX,gFAAgF;IAChF,sBAAsB;IACtB,gFAAgF;IAEhFC,gBAAgBC,MAA8B,EA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ACjG,OAAOd,KAAK,IAAI,CAACO,KAAK,CAACoC,cAAc,CAACI,MAAM,CAACpC,UAAUG;IACzD;IAEAkC,mBAAmBrC,QAAgB,EAAoB;QACrD,OAAOX,KAAK,IAAI,CAACO,KAAK,CAACoC,cAAc,CAACxB,MAAM,CAACR;IAC/C;IAEAsC,qBAAqBX,YAAoB,EAA8B;QACrE,OAAOtC,KAAK,IAAI,CAACO,KAAK,CAACoC,cAAc,CAACO,UAAU,CAACZ;IACnD;IAEA,gFAAgF;IAChF,2CAA2C;IAC3C,gFAAgF;IAEhF;;;GAGC,GACD,IAAIa,WAA4B;QAC9B,OAAO,IAAI,CAAC5C,KAAK;IACnB;IAjIA6C,YACE,AAAmBC,SAAoB,EACvC,AAA2BC,MAA6B,CACxD;QACA,IAAI,CAAC/C,KAAK,GAAGN,sBAAsBoD,WAAWC;IAChD;AA6HF;AArIalD;IADZN,WAAW;QAAEyD,YAAY;IAAO;IAK5BxD,aAAAA,OAAOG;IACPH,aAAAA,OAAOI;;;eADsB,qCAAA;eACK,iDAAA;;GAL1BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/products/index.ts"],"sourcesContent":["export * from './products.service';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,qBAAqB"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { _ as _ts_metadata } from "@swc/helpers/_/_ts_metadata";
|
|
3
|
+
import { _ as _ts_param } from "@swc/helpers/_/_ts_param";
|
|
4
|
+
import { Injectable, Inject } from '@angular/core';
|
|
5
|
+
import { from } from 'rxjs';
|
|
6
|
+
import { createProductsBlock } from '@23blocks/block-products';
|
|
7
|
+
import { TRANSPORT, PRODUCTS_CONFIG } from '../tokens.js';
|
|
8
|
+
export class ProductsService {
|
|
9
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
// Products Service
|
|
11
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
12
|
+
listProducts(params) {
|
|
13
|
+
return from(this.block.products.list(params));
|
|
14
|
+
}
|
|
15
|
+
getProduct(uniqueId) {
|
|
16
|
+
return from(this.block.products.get(uniqueId));
|
|
17
|
+
}
|
|
18
|
+
createProduct(data) {
|
|
19
|
+
return from(this.block.products.create(data));
|
|
20
|
+
}
|
|
21
|
+
updateProduct(uniqueId, data) {
|
|
22
|
+
return from(this.block.products.update(uniqueId, data));
|
|
23
|
+
}
|
|
24
|
+
deleteProduct(uniqueId) {
|
|
25
|
+
return from(this.block.products.delete(uniqueId));
|
|
26
|
+
}
|
|
27
|
+
recoverProduct(uniqueId) {
|
|
28
|
+
return from(this.block.products.recover(uniqueId));
|
|
29
|
+
}
|
|
30
|
+
searchProducts(query, params) {
|
|
31
|
+
return from(this.block.products.search(query, params));
|
|
32
|
+
}
|
|
33
|
+
listDeletedProducts(params) {
|
|
34
|
+
return from(this.block.products.listDeleted(params));
|
|
35
|
+
}
|
|
36
|
+
// Variations
|
|
37
|
+
listVariations(productUniqueId) {
|
|
38
|
+
return from(this.block.products.listVariations(productUniqueId));
|
|
39
|
+
}
|
|
40
|
+
getVariation(uniqueId) {
|
|
41
|
+
return from(this.block.products.getVariation(uniqueId));
|
|
42
|
+
}
|
|
43
|
+
createVariation(data) {
|
|
44
|
+
return from(this.block.products.createVariation(data));
|
|
45
|
+
}
|
|
46
|
+
updateVariation(uniqueId, data) {
|
|
47
|
+
return from(this.block.products.updateVariation(uniqueId, data));
|
|
48
|
+
}
|
|
49
|
+
deleteVariation(uniqueId) {
|
|
50
|
+
return from(this.block.products.deleteVariation(uniqueId));
|
|
51
|
+
}
|
|
52
|
+
// Images
|
|
53
|
+
listImages(productUniqueId) {
|
|
54
|
+
return from(this.block.products.listImages(productUniqueId));
|
|
55
|
+
}
|
|
56
|
+
addImage(productUniqueId, imageUrl, isPrimary) {
|
|
57
|
+
return from(this.block.products.addImage(productUniqueId, imageUrl, isPrimary));
|
|
58
|
+
}
|
|
59
|
+
deleteImage(uniqueId) {
|
|
60
|
+
return from(this.block.products.deleteImage(uniqueId));
|
|
61
|
+
}
|
|
62
|
+
// Stock
|
|
63
|
+
getStock(productUniqueId, vendorUniqueId) {
|
|
64
|
+
return from(this.block.products.getStock(productUniqueId, vendorUniqueId));
|
|
65
|
+
}
|
|
66
|
+
updateStock(productUniqueId, vendorUniqueId, warehouseUniqueId, quantity) {
|
|
67
|
+
return from(this.block.products.updateStock(productUniqueId, vendorUniqueId, warehouseUniqueId, quantity));
|
|
68
|
+
}
|
|
69
|
+
// Reviews
|
|
70
|
+
listReviews(productUniqueId) {
|
|
71
|
+
return from(this.block.products.listReviews(productUniqueId));
|
|
72
|
+
}
|
|
73
|
+
addReview(productUniqueId, rating, title, content) {
|
|
74
|
+
return from(this.block.products.addReview(productUniqueId, rating, title, content));
|
|
75
|
+
}
|
|
76
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
77
|
+
// Cart Service
|
|
78
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
79
|
+
getCart(userUniqueId) {
|
|
80
|
+
return from(this.block.cart.get(userUniqueId));
|
|
81
|
+
}
|
|
82
|
+
getOrCreateCart(userUniqueId) {
|
|
83
|
+
return from(this.block.cart.getOrCreate(userUniqueId));
|
|
84
|
+
}
|
|
85
|
+
updateCart(userUniqueId, data) {
|
|
86
|
+
return from(this.block.cart.update(userUniqueId, data));
|
|
87
|
+
}
|
|
88
|
+
deleteCart(userUniqueId) {
|
|
89
|
+
return from(this.block.cart.delete(userUniqueId));
|
|
90
|
+
}
|
|
91
|
+
// Cart Items
|
|
92
|
+
addCartItem(userUniqueId, item) {
|
|
93
|
+
return from(this.block.cart.addItem(userUniqueId, item));
|
|
94
|
+
}
|
|
95
|
+
updateCartItem(userUniqueId, productUniqueId, data) {
|
|
96
|
+
return from(this.block.cart.updateItem(userUniqueId, productUniqueId, data));
|
|
97
|
+
}
|
|
98
|
+
removeCartItem(userUniqueId, productUniqueId) {
|
|
99
|
+
return from(this.block.cart.removeItem(userUniqueId, productUniqueId));
|
|
100
|
+
}
|
|
101
|
+
getCartItems(userUniqueId) {
|
|
102
|
+
return from(this.block.cart.getItems(userUniqueId));
|
|
103
|
+
}
|
|
104
|
+
// Checkout
|
|
105
|
+
checkout(userUniqueId, data) {
|
|
106
|
+
return from(this.block.cart.checkout(userUniqueId, data));
|
|
107
|
+
}
|
|
108
|
+
orderCart(userUniqueId) {
|
|
109
|
+
return from(this.block.cart.order(userUniqueId));
|
|
110
|
+
}
|
|
111
|
+
orderCartItem(userUniqueId, productUniqueId) {
|
|
112
|
+
return from(this.block.cart.orderItem(userUniqueId, productUniqueId));
|
|
113
|
+
}
|
|
114
|
+
cancelCart(userUniqueId) {
|
|
115
|
+
return from(this.block.cart.cancel(userUniqueId));
|
|
116
|
+
}
|
|
117
|
+
cancelCartItem(userUniqueId, productUniqueId) {
|
|
118
|
+
return from(this.block.cart.cancelItem(userUniqueId, productUniqueId));
|
|
119
|
+
}
|
|
120
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
121
|
+
// Categories Service
|
|
122
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
123
|
+
listCategories(params) {
|
|
124
|
+
return from(this.block.categories.list(params));
|
|
125
|
+
}
|
|
126
|
+
getCategory(uniqueId) {
|
|
127
|
+
return from(this.block.categories.get(uniqueId));
|
|
128
|
+
}
|
|
129
|
+
createCategory(data) {
|
|
130
|
+
return from(this.block.categories.create(data));
|
|
131
|
+
}
|
|
132
|
+
updateCategory(uniqueId, data) {
|
|
133
|
+
return from(this.block.categories.update(uniqueId, data));
|
|
134
|
+
}
|
|
135
|
+
deleteCategory(uniqueId) {
|
|
136
|
+
return from(this.block.categories.delete(uniqueId));
|
|
137
|
+
}
|
|
138
|
+
recoverCategory(uniqueId) {
|
|
139
|
+
return from(this.block.categories.recover(uniqueId));
|
|
140
|
+
}
|
|
141
|
+
getCategoryChildren(uniqueId) {
|
|
142
|
+
return from(this.block.categories.getChildren(uniqueId));
|
|
143
|
+
}
|
|
144
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
145
|
+
// Brands Service
|
|
146
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
147
|
+
listBrands(page, perPage) {
|
|
148
|
+
return from(this.block.brands.list(page, perPage));
|
|
149
|
+
}
|
|
150
|
+
getBrand(uniqueId) {
|
|
151
|
+
return from(this.block.brands.get(uniqueId));
|
|
152
|
+
}
|
|
153
|
+
createBrand(data) {
|
|
154
|
+
return from(this.block.brands.create(data));
|
|
155
|
+
}
|
|
156
|
+
updateBrand(uniqueId, data) {
|
|
157
|
+
return from(this.block.brands.update(uniqueId, data));
|
|
158
|
+
}
|
|
159
|
+
deleteBrand(uniqueId) {
|
|
160
|
+
return from(this.block.brands.delete(uniqueId));
|
|
161
|
+
}
|
|
162
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
163
|
+
// Vendors Service
|
|
164
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
165
|
+
listVendors(params) {
|
|
166
|
+
return from(this.block.vendors.list(params));
|
|
167
|
+
}
|
|
168
|
+
getVendor(uniqueId) {
|
|
169
|
+
return from(this.block.vendors.get(uniqueId));
|
|
170
|
+
}
|
|
171
|
+
createVendor(data) {
|
|
172
|
+
return from(this.block.vendors.create(data));
|
|
173
|
+
}
|
|
174
|
+
updateVendor(uniqueId, data) {
|
|
175
|
+
return from(this.block.vendors.update(uniqueId, data));
|
|
176
|
+
}
|
|
177
|
+
deleteVendor(uniqueId) {
|
|
178
|
+
return from(this.block.vendors.delete(uniqueId));
|
|
179
|
+
}
|
|
180
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
181
|
+
// Warehouses Service
|
|
182
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
183
|
+
listWarehouses(params) {
|
|
184
|
+
return from(this.block.warehouses.list(params));
|
|
185
|
+
}
|
|
186
|
+
getWarehouse(uniqueId) {
|
|
187
|
+
return from(this.block.warehouses.get(uniqueId));
|
|
188
|
+
}
|
|
189
|
+
createWarehouse(data) {
|
|
190
|
+
return from(this.block.warehouses.create(data));
|
|
191
|
+
}
|
|
192
|
+
updateWarehouse(uniqueId, data) {
|
|
193
|
+
return from(this.block.warehouses.update(uniqueId, data));
|
|
194
|
+
}
|
|
195
|
+
deleteWarehouse(uniqueId) {
|
|
196
|
+
return from(this.block.warehouses.delete(uniqueId));
|
|
197
|
+
}
|
|
198
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
199
|
+
// Channels Service
|
|
200
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
201
|
+
listChannels() {
|
|
202
|
+
return from(this.block.channels.list());
|
|
203
|
+
}
|
|
204
|
+
getChannel(uniqueId) {
|
|
205
|
+
return from(this.block.channels.get(uniqueId));
|
|
206
|
+
}
|
|
207
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
208
|
+
// Collections Service
|
|
209
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
210
|
+
listCollections() {
|
|
211
|
+
return from(this.block.collections.list());
|
|
212
|
+
}
|
|
213
|
+
getCollection(uniqueId) {
|
|
214
|
+
return from(this.block.collections.get(uniqueId));
|
|
215
|
+
}
|
|
216
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
217
|
+
// Direct Block Access (for advanced usage)
|
|
218
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
219
|
+
/**
|
|
220
|
+
* Access the underlying block for advanced operations
|
|
221
|
+
* Use this when you need access to services not wrapped by this Angular service
|
|
222
|
+
*/ get rawBlock() {
|
|
223
|
+
return this.block;
|
|
224
|
+
}
|
|
225
|
+
constructor(transport, config){
|
|
226
|
+
this.block = createProductsBlock(transport, config);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
ProductsService = _ts_decorate([
|
|
230
|
+
Injectable({
|
|
231
|
+
providedIn: 'root'
|
|
232
|
+
}),
|
|
233
|
+
_ts_param(0, Inject(TRANSPORT)),
|
|
234
|
+
_ts_param(1, Inject(PRODUCTS_CONFIG)),
|
|
235
|
+
_ts_metadata("design:type", Function),
|
|
236
|
+
_ts_metadata("design:paramtypes", [
|
|
237
|
+
typeof Transport === "undefined" ? Object : Transport,
|
|
238
|
+
typeof ProductsBlockConfig === "undefined" ? Object : ProductsBlockConfig
|
|
239
|
+
])
|
|
240
|
+
], ProductsService);
|
|
241
|
+
|
|
242
|
+
//# sourceMappingURL=products.service.js.map
|