@juzi/wechaty 1.0.133 → 1.0.135
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/cjs/src/mods/impls.d.ts +3 -3
- package/dist/cjs/src/mods/impls.d.ts.map +1 -1
- package/dist/cjs/src/mods/impls.js +3 -1
- package/dist/cjs/src/mods/impls.js.map +1 -1
- package/dist/cjs/src/mods/users.d.ts +1 -1
- package/dist/cjs/src/mods/users.d.ts.map +1 -1
- package/dist/cjs/src/package-json.js +3 -3
- package/dist/cjs/src/sayable/deliver-sayable.d.ts.map +1 -1
- package/dist/cjs/src/sayable/deliver-sayable.js +6 -0
- package/dist/cjs/src/sayable/deliver-sayable.js.map +1 -1
- package/dist/cjs/src/sayable/types.d.ts +2 -2
- package/dist/cjs/src/sayable/types.d.ts.map +1 -1
- package/dist/cjs/src/sayable/types.js.map +1 -1
- package/dist/cjs/src/schemas/wechaty-events.d.ts +9 -0
- package/dist/cjs/src/schemas/wechaty-events.d.ts.map +1 -1
- package/dist/cjs/src/schemas/wechaty-events.js.map +1 -1
- package/dist/cjs/src/user-modules/im-specific.d.ts +1 -0
- package/dist/cjs/src/user-modules/im-specific.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/im-specific.js +4 -0
- package/dist/cjs/src/user-modules/im-specific.js.map +1 -1
- package/dist/cjs/src/user-modules/mod.d.ts +5 -3
- package/dist/cjs/src/user-modules/mod.d.ts.map +1 -1
- package/dist/cjs/src/user-modules/mod.js +5 -1
- package/dist/cjs/src/user-modules/mod.js.map +1 -1
- package/dist/cjs/src/user-modules/wxxd-order.d.ts +91 -0
- package/dist/cjs/src/user-modules/wxxd-order.d.ts.map +1 -0
- package/dist/cjs/src/user-modules/wxxd-order.js +140 -0
- package/dist/cjs/src/user-modules/wxxd-order.js.map +1 -0
- package/dist/cjs/src/user-modules/wxxd-product.d.ts +87 -0
- package/dist/cjs/src/user-modules/wxxd-product.d.ts.map +1 -0
- package/dist/cjs/src/user-modules/wxxd-product.js +134 -0
- package/dist/cjs/src/user-modules/wxxd-product.js.map +1 -0
- package/dist/cjs/src/wechaty/wechaty-base.d.ts +27 -7
- package/dist/cjs/src/wechaty/wechaty-base.d.ts.map +1 -1
- package/dist/cjs/src/wechaty/wechaty-impl.spec.js +5 -1
- package/dist/cjs/src/wechaty/wechaty-impl.spec.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/gerror-mixin.d.ts +1 -1
- package/dist/cjs/src/wechaty-mixins/io-mixin.d.ts +2 -2
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts +17 -5
- package/dist/cjs/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts +17 -5
- package/dist/cjs/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts +22 -6
- package/dist/cjs/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts +14 -10
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.js +18 -0
- package/dist/cjs/src/wechaty-mixins/puppet-mixin.js.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +7 -3
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js +6 -0
- package/dist/cjs/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
- package/dist/esm/src/mods/impls.d.ts +3 -3
- package/dist/esm/src/mods/impls.d.ts.map +1 -1
- package/dist/esm/src/mods/impls.js +1 -1
- package/dist/esm/src/mods/impls.js.map +1 -1
- package/dist/esm/src/mods/users.d.ts +1 -1
- package/dist/esm/src/mods/users.d.ts.map +1 -1
- package/dist/esm/src/package-json.js +3 -3
- package/dist/esm/src/sayable/deliver-sayable.d.ts.map +1 -1
- package/dist/esm/src/sayable/deliver-sayable.js +7 -1
- package/dist/esm/src/sayable/deliver-sayable.js.map +1 -1
- package/dist/esm/src/sayable/types.d.ts +2 -2
- package/dist/esm/src/sayable/types.d.ts.map +1 -1
- package/dist/esm/src/sayable/types.js.map +1 -1
- package/dist/esm/src/schemas/wechaty-events.d.ts +9 -0
- package/dist/esm/src/schemas/wechaty-events.d.ts.map +1 -1
- package/dist/esm/src/schemas/wechaty-events.js.map +1 -1
- package/dist/esm/src/user-modules/im-specific.d.ts +1 -0
- package/dist/esm/src/user-modules/im-specific.d.ts.map +1 -1
- package/dist/esm/src/user-modules/im-specific.js +4 -0
- package/dist/esm/src/user-modules/im-specific.js.map +1 -1
- package/dist/esm/src/user-modules/mod.d.ts +5 -3
- package/dist/esm/src/user-modules/mod.d.ts.map +1 -1
- package/dist/esm/src/user-modules/mod.js +3 -1
- package/dist/esm/src/user-modules/mod.js.map +1 -1
- package/dist/esm/src/user-modules/wxxd-order.d.ts +91 -0
- package/dist/esm/src/user-modules/wxxd-order.d.ts.map +1 -0
- package/dist/esm/src/user-modules/wxxd-order.js +114 -0
- package/dist/esm/src/user-modules/wxxd-order.js.map +1 -0
- package/dist/esm/src/user-modules/wxxd-product.d.ts +87 -0
- package/dist/esm/src/user-modules/wxxd-product.d.ts.map +1 -0
- package/dist/esm/src/user-modules/wxxd-product.js +108 -0
- package/dist/esm/src/user-modules/wxxd-product.js.map +1 -0
- package/dist/esm/src/wechaty/wechaty-base.d.ts +27 -7
- package/dist/esm/src/wechaty/wechaty-base.d.ts.map +1 -1
- package/dist/esm/src/wechaty/wechaty-impl.spec.js +5 -1
- package/dist/esm/src/wechaty/wechaty-impl.spec.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/gerror-mixin.d.ts +1 -1
- package/dist/esm/src/wechaty-mixins/io-mixin.d.ts +2 -2
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts +17 -5
- package/dist/esm/src/wechaty-mixins/login-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts +17 -5
- package/dist/esm/src/wechaty-mixins/misc-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts +22 -6
- package/dist/esm/src/wechaty-mixins/plugin-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts +14 -10
- package/dist/esm/src/wechaty-mixins/puppet-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/puppet-mixin.js +18 -0
- package/dist/esm/src/wechaty-mixins/puppet-mixin.js.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts +7 -3
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.d.ts.map +1 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js +7 -1
- package/dist/esm/src/wechaty-mixins/wechatify-user-module-mixin.js.map +1 -1
- package/package.json +2 -2
- package/src/mods/impls.ts +6 -0
- package/src/mods/users.ts +2 -0
- package/src/package-json.ts +3 -3
- package/src/sayable/deliver-sayable.ts +12 -0
- package/src/sayable/types.ts +4 -0
- package/src/schemas/wechaty-events.ts +6 -0
- package/src/user-modules/im-specific.ts +5 -0
- package/src/user-modules/mod.ts +16 -0
- package/src/user-modules/wxxd-order.ts +161 -0
- package/src/user-modules/wxxd-product.ts +154 -0
- package/src/wechaty/wechaty-impl.spec.ts +6 -0
- package/src/wechaty-mixins/puppet-mixin.ts +21 -0
- package/src/wechaty-mixins/wechatify-user-module-mixin.ts +12 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from '@juzi/wechaty-puppet';
|
|
2
|
-
import { ContactImpl, ContactSelfImpl, DelayImpl, FriendshipImpl, ImageImpl, LocationImpl, MessageImpl, MiniProgramImpl, PostImpl, RoomImpl, RoomInvitationImpl, TagImpl, TagGroupImpl, UrlLinkImpl, ChannelImpl, ChannelCardImpl, ConsultCardImpl, PremiumOnlineAppointmentCardImpl, MomentImpl, CallRecordImpl, ChatHistoryImpl, WecomImpl, DouyinOneClickPhoneCollectionImpl, ImSpecificImpl, wechatifyUserModule, } from '../user-modules/mod.js';
|
|
2
|
+
import { ContactImpl, ContactSelfImpl, DelayImpl, FriendshipImpl, ImageImpl, LocationImpl, MessageImpl, MiniProgramImpl, PostImpl, RoomImpl, RoomInvitationImpl, TagImpl, TagGroupImpl, UrlLinkImpl, ChannelImpl, ChannelCardImpl, ConsultCardImpl, PremiumOnlineAppointmentCardImpl, MomentImpl, CallRecordImpl, ChatHistoryImpl, WecomImpl, DouyinOneClickPhoneCollectionImpl, ImSpecificImpl, WxxdProductImpl, WxxdOrderImpl, wechatifyUserModule, } from '../user-modules/mod.js';
|
|
3
3
|
const wechatifyUserModuleMixin = (mixinBase) => {
|
|
4
4
|
log.verbose('WechatifyUserModuleMixin', 'wechatifyUserModuleMixin(%s)', mixinBase.name);
|
|
5
5
|
class WechatifyUserModuleMixin extends mixinBase {
|
|
@@ -31,6 +31,8 @@ const wechatifyUserModuleMixin = (mixinBase) => {
|
|
|
31
31
|
__wechatifiedWecom;
|
|
32
32
|
__wechatifiedDouyinOneClickPhoneCollection;
|
|
33
33
|
__wechatifiedImSpecific;
|
|
34
|
+
__wechatifiedWxxdProduct;
|
|
35
|
+
__wechatifiedWxxdOrder;
|
|
34
36
|
get Contact() { return guardWechatify(this.__wechatifiedContact); }
|
|
35
37
|
get ContactSelf() { return guardWechatify(this.__wechatifiedContactSelf); }
|
|
36
38
|
get Delay() { return guardWechatify(this.__wechatifiedDelay); }
|
|
@@ -55,6 +57,8 @@ const wechatifyUserModuleMixin = (mixinBase) => {
|
|
|
55
57
|
get Wecom() { return guardWechatify(this.__wechatifiedWecom); }
|
|
56
58
|
get DouyinOneClickPhoneCollection() { return guardWechatify(this.__wechatifiedDouyinOneClickPhoneCollection); }
|
|
57
59
|
get ImSpecific() { return guardWechatify(this.__wechatifiedImSpecific); }
|
|
60
|
+
get WxxdProduct() { return guardWechatify(this.__wechatifiedWxxdProduct); }
|
|
61
|
+
get WxxdOrder() { return guardWechatify(this.__wechatifiedWxxdOrder); }
|
|
58
62
|
async init() {
|
|
59
63
|
log.verbose('WechatifyUserModuleMixin', 'init()');
|
|
60
64
|
await super.init();
|
|
@@ -96,6 +100,8 @@ const wechatifyUserModuleMixin = (mixinBase) => {
|
|
|
96
100
|
this.__wechatifiedWecom = wechatifyUserModule(WecomImpl)(this);
|
|
97
101
|
this.__wechatifiedDouyinOneClickPhoneCollection = wechatifyUserModule(DouyinOneClickPhoneCollectionImpl)(this);
|
|
98
102
|
this.__wechatifiedImSpecific = wechatifyUserModule(ImSpecificImpl)(this);
|
|
103
|
+
this.__wechatifiedWxxdProduct = wechatifyUserModule(WxxdProductImpl)(this);
|
|
104
|
+
this.__wechatifiedWxxdOrder = wechatifyUserModule(WxxdOrderImpl)(this);
|
|
99
105
|
log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done');
|
|
100
106
|
}
|
|
101
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wechatify-user-module-mixin.js","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAe,sBAAsB,CAAA;AAEnD,OAAO,EACL,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,gCAAgC,EAChC,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,iCAAiC,EACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"wechatify-user-module-mixin.js","sourceRoot":"","sources":["../../../../src/wechaty-mixins/wechatify-user-module-mixin.ts"],"names":[],"mappings":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CAAC,IAAW,CAAC,CAAA;YAEjG,GAAG,CAAC,OAAO,CAAC,0BAA0B,EAAE,wDAAwD,CAAC,CAAA;QACnG,CAAC;KAEF;IAED,OAAO,wBAAwB,CAAA;AACjC,CAAC,CAAA;AAED;;GAEG;AACH,SAAS,cAAc,CAAsB,UAAc;IACzD,IAAI,UAAU,EAAE;QACd,OAAO,UAAU,CAAA;KAClB;IACD,MAAM,IAAI,KAAK,CAAC,8FAA8F,CAAC,CAAA;AACjH,CAAC;AAmCD,OAAO,EACL,wBAAwB,GACzB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juzi/wechaty",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.135",
|
|
4
4
|
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"@chatie/eslint-config": "^1.0.4",
|
|
133
133
|
"@chatie/semver": "^0.4.7",
|
|
134
134
|
"@chatie/tsconfig": "^4.6.3",
|
|
135
|
-
"@juzi/wechaty-puppet": "^1.0.
|
|
135
|
+
"@juzi/wechaty-puppet": "^1.0.130",
|
|
136
136
|
"@juzi/wechaty-puppet-mock": "^1.0.1",
|
|
137
137
|
"@swc/core": "1.3.44",
|
|
138
138
|
"@swc/helpers": "^0.3.6",
|
package/src/mods/impls.ts
CHANGED
|
@@ -56,6 +56,8 @@ export {
|
|
|
56
56
|
PremiumOnlineAppointmentCardImpl,
|
|
57
57
|
DouyinOneClickPhoneCollectionImpl,
|
|
58
58
|
ImSpecificImpl,
|
|
59
|
+
WxxdProductImpl,
|
|
60
|
+
WxxdOrderImpl,
|
|
59
61
|
} from '../user-modules/mod.js'
|
|
60
62
|
|
|
61
63
|
// export {
|
|
@@ -103,6 +105,8 @@ export type {
|
|
|
103
105
|
PremiumOnlineAppointmentCardInterface,
|
|
104
106
|
DouyinOneClickPhoneCollectionInterface,
|
|
105
107
|
ImSpecificInterface,
|
|
108
|
+
WxxdProductInterface,
|
|
109
|
+
WxxdOrderInterface,
|
|
106
110
|
} from '../user-modules/mod.js'
|
|
107
111
|
|
|
108
112
|
export type {
|
|
@@ -130,6 +134,8 @@ export type {
|
|
|
130
134
|
PremiumOnlineAppointmentCardConstructor,
|
|
131
135
|
DouyinOneClickPhoneCollectionConstructor,
|
|
132
136
|
ImSpecificConstructor,
|
|
137
|
+
WxxdProductConstructor,
|
|
138
|
+
WxxdOrderConstructor,
|
|
133
139
|
} from '../user-modules/mod.js'
|
|
134
140
|
|
|
135
141
|
export {
|
package/src/mods/users.ts
CHANGED
|
@@ -50,4 +50,6 @@ export type {
|
|
|
50
50
|
PremiumOnlineAppointmentCardInterface as PremiumOnlineAppointmentCard,
|
|
51
51
|
DouyinOneClickPhoneCollectionInterface as DouyinOneClickPhoneCollection,
|
|
52
52
|
ImSpecificInterface as ImSpecific,
|
|
53
|
+
WxxdProductInterface as WxxdProduct,
|
|
54
|
+
WxxdOrderInterface as WxxdOrder,
|
|
53
55
|
} from '../user-modules/mod.js'
|
package/src/package-json.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { PackageJsonWechaty } from './config'
|
|
6
6
|
|
|
7
|
-
export const GIT_COMMIT_HASH: string = '
|
|
7
|
+
export const GIT_COMMIT_HASH: string = '472342cce6ab67487ac75a2de0fce297f3875e2b'
|
|
8
8
|
export const packageJson: PackageJsonWechaty = {
|
|
9
9
|
"name": "@juzi/wechaty",
|
|
10
|
-
"version": "1.0.
|
|
10
|
+
"version": "1.0.135",
|
|
11
11
|
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": {
|
|
@@ -139,7 +139,7 @@ export const packageJson: PackageJsonWechaty = {
|
|
|
139
139
|
"@chatie/eslint-config": "^1.0.4",
|
|
140
140
|
"@chatie/semver": "^0.4.7",
|
|
141
141
|
"@chatie/tsconfig": "^4.6.3",
|
|
142
|
-
"@juzi/wechaty-puppet": "^1.0.
|
|
142
|
+
"@juzi/wechaty-puppet": "^1.0.130",
|
|
143
143
|
"@juzi/wechaty-puppet-mock": "^1.0.1",
|
|
144
144
|
"@swc/core": "1.3.44",
|
|
145
145
|
"@swc/helpers": "^0.3.6",
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
PremiumOnlineAppointmentCardImpl,
|
|
15
15
|
ConsultCardImpl,
|
|
16
16
|
DouyinOneClickPhoneCollectionImpl,
|
|
17
|
+
WxxdProductImpl,
|
|
18
|
+
WxxdOrderImpl,
|
|
17
19
|
} from '../user-modules/mod.js'
|
|
18
20
|
|
|
19
21
|
import type { Sayable, SayOptionsObject } from './types.js'
|
|
@@ -132,6 +134,16 @@ const deliverSayableConversationPuppet = (puppet: PUPPET.impls.PuppetInterface)
|
|
|
132
134
|
conversationId,
|
|
133
135
|
{},
|
|
134
136
|
)
|
|
137
|
+
} else if (WxxdProductImpl.validInstance(sayable)) {
|
|
138
|
+
msgId = await puppet.messageSendWxxdProduct(
|
|
139
|
+
conversationId,
|
|
140
|
+
sayable.id,
|
|
141
|
+
)
|
|
142
|
+
} else if (WxxdOrderImpl.validInstance(sayable)) {
|
|
143
|
+
msgId = await puppet.messageSendWxxdOrder(
|
|
144
|
+
conversationId,
|
|
145
|
+
sayable.id,
|
|
146
|
+
)
|
|
135
147
|
} else {
|
|
136
148
|
throw new Error('unsupported arg: ' + sayable)
|
|
137
149
|
}
|
package/src/sayable/types.ts
CHANGED
|
@@ -36,6 +36,8 @@ import {
|
|
|
36
36
|
ConsultCardInterface,
|
|
37
37
|
PremiumOnlineAppointmentCardInterface,
|
|
38
38
|
DouyinOneClickPhoneCollectionInterface,
|
|
39
|
+
WxxdProductInterface,
|
|
40
|
+
WxxdOrderInterface,
|
|
39
41
|
} from '../user-modules/mod.js'
|
|
40
42
|
|
|
41
43
|
import type {
|
|
@@ -58,6 +60,8 @@ type Sayable =
|
|
|
58
60
|
| ConsultCardInterface
|
|
59
61
|
| PremiumOnlineAppointmentCardInterface
|
|
60
62
|
| DouyinOneClickPhoneCollectionInterface
|
|
63
|
+
| WxxdProductInterface
|
|
64
|
+
| WxxdOrderInterface
|
|
61
65
|
|
|
62
66
|
interface SayableSayer {
|
|
63
67
|
id : string,
|
|
@@ -60,6 +60,9 @@ type WechatyEventListenerLoginUrl = (url: string) => void | Promise<vo
|
|
|
60
60
|
type WechatyEventListenerIntentComment = (payload: PUPPET.payloads.IntentComment) => void | Promise<void>
|
|
61
61
|
type WechatyEventListenerContactEnterConversation = (contact: ContactInterface, date?: Date) => void | Promise<void>
|
|
62
62
|
type WechatyEventListenerContactLeadFilled = (contact: ContactInterface, leads: { name: string, value: string }[], date?: Date) => void | Promise<void>
|
|
63
|
+
type WechatyEventListenerWxxdShop = (payload: PUPPET.payloads.WxxdShop) => void | Promise<void>
|
|
64
|
+
type WechatyEventListenerWxxdProduct = (payload: PUPPET.payloads.WxxdProduct) => void | Promise<void>
|
|
65
|
+
type WechatyEventListenerWxxdOrder = (payload: PUPPET.payloads.WxxdOrder) => void | Promise<void>
|
|
63
66
|
|
|
64
67
|
/**
|
|
65
68
|
* @desc Wechaty Class Event Type
|
|
@@ -245,6 +248,9 @@ interface WechatyEventListeners {
|
|
|
245
248
|
'verify-slide' : WechatyEventListenerVerifySlide
|
|
246
249
|
'contact-enter-conversation' : WechatyEventListenerContactEnterConversation
|
|
247
250
|
'contact-lead-filled' : WechatyEventListenerContactLeadFilled
|
|
251
|
+
'wxxd-shop' : WechatyEventListenerWxxdShop
|
|
252
|
+
'wxxd-product' : WechatyEventListenerWxxdProduct
|
|
253
|
+
'wxxd-order' : WechatyEventListenerWxxdOrder
|
|
248
254
|
}
|
|
249
255
|
|
|
250
256
|
const WechatyEventEmitter = EventEmitter as any as new () => TypedEventEmitter<
|
package/src/user-modules/mod.ts
CHANGED
|
@@ -147,6 +147,16 @@ import {
|
|
|
147
147
|
ImSpecificInterface,
|
|
148
148
|
ImSpecificConstructor,
|
|
149
149
|
} from './im-specific.js'
|
|
150
|
+
import {
|
|
151
|
+
WxxdProductImpl,
|
|
152
|
+
WxxdProductInterface,
|
|
153
|
+
WxxdProductConstructor,
|
|
154
|
+
} from './wxxd-product.js'
|
|
155
|
+
import {
|
|
156
|
+
WxxdOrderImpl,
|
|
157
|
+
WxxdOrderInterface,
|
|
158
|
+
WxxdOrderConstructor,
|
|
159
|
+
} from './wxxd-order.js'
|
|
150
160
|
|
|
151
161
|
import { wechatifyUserModule } from '../user-mixins/wechatify.js'
|
|
152
162
|
|
|
@@ -177,6 +187,8 @@ export type {
|
|
|
177
187
|
WecomInterface,
|
|
178
188
|
DouyinOneClickPhoneCollectionInterface,
|
|
179
189
|
ImSpecificInterface,
|
|
190
|
+
WxxdProductInterface,
|
|
191
|
+
WxxdOrderInterface,
|
|
180
192
|
}
|
|
181
193
|
|
|
182
194
|
export type {
|
|
@@ -206,6 +218,8 @@ export type {
|
|
|
206
218
|
WecomConstructor,
|
|
207
219
|
DouyinOneClickPhoneCollectionConstructor,
|
|
208
220
|
ImSpecificConstructor,
|
|
221
|
+
WxxdProductConstructor,
|
|
222
|
+
WxxdOrderConstructor,
|
|
209
223
|
}
|
|
210
224
|
|
|
211
225
|
export {
|
|
@@ -237,4 +251,6 @@ export {
|
|
|
237
251
|
WecomImpl,
|
|
238
252
|
DouyinOneClickPhoneCollectionImpl,
|
|
239
253
|
ImSpecificImpl,
|
|
254
|
+
WxxdProductImpl,
|
|
255
|
+
WxxdOrderImpl,
|
|
240
256
|
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { Constructor } from 'clone-class'
|
|
2
|
+
import type { PaginationRequest } from '@juzi/wechaty-puppet/filters'
|
|
3
|
+
import * as PUPPET from '@juzi/wechaty-puppet'
|
|
4
|
+
|
|
5
|
+
import { log } from '../config.js'
|
|
6
|
+
import { poolifyMixin } from '../user-mixins/poolify.js'
|
|
7
|
+
import { validationMixin } from '../user-mixins/validation.js'
|
|
8
|
+
import { wechatifyMixin } from '../user-mixins/wechatify.js'
|
|
9
|
+
|
|
10
|
+
const MixinBase = wechatifyMixin(
|
|
11
|
+
poolifyMixin(Object)<WxxdOrderImplInterface>(),
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
class WxxdOrderMixin extends MixinBase {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Instance properties
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
payload?: PUPPET.payloads.WxxdOrder
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @hideconstructor
|
|
24
|
+
*/
|
|
25
|
+
constructor (
|
|
26
|
+
public readonly id: string,
|
|
27
|
+
) {
|
|
28
|
+
super()
|
|
29
|
+
log.silly('WxxdOrder', 'constructor(%s)', id)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* List all orders
|
|
34
|
+
*/
|
|
35
|
+
static async list (query: PaginationRequest) {
|
|
36
|
+
log.verbose('WxxdOrder', 'list(%s)', JSON.stringify(query))
|
|
37
|
+
|
|
38
|
+
return await this.wechaty.puppet.listWxxdOrders(query)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Find order by id or filter
|
|
43
|
+
*/
|
|
44
|
+
static async find (
|
|
45
|
+
query: string | { id: string },
|
|
46
|
+
): Promise<WxxdOrderInterface | undefined> {
|
|
47
|
+
log.verbose('WxxdOrder', 'find(%s)', JSON.stringify(query))
|
|
48
|
+
|
|
49
|
+
const id = typeof query === 'string' ? query : query.id
|
|
50
|
+
|
|
51
|
+
if (!id) {
|
|
52
|
+
return undefined
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const order = (this.wechaty.WxxdOrder as any as typeof WxxdOrderImpl).load(id)
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
await order.ready()
|
|
59
|
+
} catch (e) {
|
|
60
|
+
this.wechaty.emitError(e)
|
|
61
|
+
return undefined
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return order
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
isReady (): boolean {
|
|
68
|
+
return !!(this.payload && this.payload.orderId)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async ready (forceSync = false): Promise<void> {
|
|
72
|
+
log.silly('WxxdOrder', 'ready() @ %s with id="%s"', this.wechaty.puppet, this.id)
|
|
73
|
+
|
|
74
|
+
if (!forceSync && this.isReady()) {
|
|
75
|
+
log.silly('WxxdOrder', 'ready() isReady() true')
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
this.payload = await this.wechaty.puppet.wxxdOrderPayload(this.id)
|
|
81
|
+
} catch (e) {
|
|
82
|
+
this.wechaty.emitError(e)
|
|
83
|
+
log.verbose('WxxdOrder', 'ready() this.wechaty.puppet.wxxdOrderPayload(%s) exception: %s',
|
|
84
|
+
this.id,
|
|
85
|
+
(e as Error).message,
|
|
86
|
+
)
|
|
87
|
+
throw e
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get order ID
|
|
93
|
+
*/
|
|
94
|
+
orderId (): string {
|
|
95
|
+
return this.payload?.orderId || this.id
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get order open ID
|
|
100
|
+
*/
|
|
101
|
+
openId (): string {
|
|
102
|
+
return this.payload?.openId || ''
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get order status
|
|
107
|
+
*/
|
|
108
|
+
status (): PUPPET.types.WxxdOrderStatus {
|
|
109
|
+
return this.payload?.status || PUPPET.types.WxxdOrderStatus.Unpaid
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get order create time
|
|
114
|
+
*/
|
|
115
|
+
createTime (): number {
|
|
116
|
+
return this.payload?.createTime || 0
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get order update time
|
|
121
|
+
*/
|
|
122
|
+
updateTime (): number {
|
|
123
|
+
return this.payload?.updateTime || 0
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get order products
|
|
128
|
+
*/
|
|
129
|
+
products (): PUPPET.payloads.WxxdOrderProduct[] {
|
|
130
|
+
return this.payload?.products || []
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get order ext info
|
|
135
|
+
*/
|
|
136
|
+
extInfo (): PUPPET.payloads.WxxdOrderExtInfo | undefined {
|
|
137
|
+
return this.payload?.extInfo
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
class WxxdOrderImplBase extends validationMixin(WxxdOrderMixin)<WxxdOrderImplInterface>() { }
|
|
143
|
+
interface WxxdOrderImplInterface extends WxxdOrderImplBase { }
|
|
144
|
+
|
|
145
|
+
type WxxdOrderProtectedProperty = 'ready'
|
|
146
|
+
type WxxdOrderInterface = Omit<WxxdOrderImplInterface, WxxdOrderProtectedProperty>
|
|
147
|
+
class WxxdOrderImpl extends validationMixin(WxxdOrderImplBase)<WxxdOrderInterface>() { }
|
|
148
|
+
|
|
149
|
+
type WxxdOrderConstructor = Constructor<
|
|
150
|
+
WxxdOrderImplInterface,
|
|
151
|
+
typeof WxxdOrderImpl
|
|
152
|
+
>
|
|
153
|
+
|
|
154
|
+
export type {
|
|
155
|
+
WxxdOrderConstructor,
|
|
156
|
+
WxxdOrderProtectedProperty,
|
|
157
|
+
WxxdOrderInterface,
|
|
158
|
+
}
|
|
159
|
+
export {
|
|
160
|
+
WxxdOrderImpl,
|
|
161
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { Constructor } from 'clone-class'
|
|
2
|
+
import type { PaginationRequest } from '@juzi/wechaty-puppet/filters'
|
|
3
|
+
import * as PUPPET from '@juzi/wechaty-puppet'
|
|
4
|
+
|
|
5
|
+
import { log } from '../config.js'
|
|
6
|
+
import { poolifyMixin } from '../user-mixins/poolify.js'
|
|
7
|
+
import { validationMixin } from '../user-mixins/validation.js'
|
|
8
|
+
import { wechatifyMixin } from '../user-mixins/wechatify.js'
|
|
9
|
+
|
|
10
|
+
const MixinBase = wechatifyMixin(
|
|
11
|
+
poolifyMixin(Object)<WxxdProductImplInterface>(),
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
class WxxdProductMixin extends MixinBase {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Instance properties
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
payload?: PUPPET.payloads.WxxdProduct
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @hideconstructor
|
|
24
|
+
*/
|
|
25
|
+
constructor (
|
|
26
|
+
public readonly id: string,
|
|
27
|
+
) {
|
|
28
|
+
super()
|
|
29
|
+
log.silly('WxxdProduct', 'constructor(%s)', id)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* List all products
|
|
34
|
+
*/
|
|
35
|
+
static async list (query: PaginationRequest) {
|
|
36
|
+
log.verbose('WxxdProduct', 'list(%s)', JSON.stringify(query))
|
|
37
|
+
|
|
38
|
+
return await this.wechaty.puppet.listWxxdProducts(query)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Find product by id or filter
|
|
43
|
+
*/
|
|
44
|
+
static async find (
|
|
45
|
+
query: string | { id: string },
|
|
46
|
+
): Promise<WxxdProductInterface | undefined> {
|
|
47
|
+
log.verbose('WxxdProduct', 'find(%s)', JSON.stringify(query))
|
|
48
|
+
|
|
49
|
+
const id = typeof query === 'string' ? query : query.id
|
|
50
|
+
|
|
51
|
+
if (!id) {
|
|
52
|
+
return undefined
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const product = (this.wechaty.WxxdProduct as any as typeof WxxdProductImpl).load(id)
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
await product.ready()
|
|
59
|
+
} catch (e) {
|
|
60
|
+
this.wechaty.emitError(e)
|
|
61
|
+
return undefined
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return product
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
isReady (): boolean {
|
|
68
|
+
return !!(this.payload && this.payload.productId)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async ready (forceSync = false): Promise<void> {
|
|
72
|
+
log.silly('WxxdProduct', 'ready() @ %s with id="%s"', this.wechaty.puppet, this.id)
|
|
73
|
+
|
|
74
|
+
if (!forceSync && this.isReady()) {
|
|
75
|
+
log.silly('WxxdProduct', 'ready() isReady() true')
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
this.payload = await this.wechaty.puppet.wxxdProductPayload(this.id)
|
|
81
|
+
} catch (e) {
|
|
82
|
+
this.wechaty.emitError(e)
|
|
83
|
+
log.verbose('WxxdProduct', 'ready() this.wechaty.puppet.wxxdProductPayload(%s) exception: %s',
|
|
84
|
+
this.id,
|
|
85
|
+
(e as Error).message,
|
|
86
|
+
)
|
|
87
|
+
throw e
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get product title
|
|
93
|
+
*/
|
|
94
|
+
title (): string {
|
|
95
|
+
return this.payload?.title || ''
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get product short title
|
|
100
|
+
*/
|
|
101
|
+
shortTitle (): string {
|
|
102
|
+
return this.payload?.shortTitle || ''
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get product status
|
|
107
|
+
*/
|
|
108
|
+
status (): PUPPET.types.WxxdProductStatus {
|
|
109
|
+
return this.payload?.status || PUPPET.types.WxxdProductStatus.NotExist
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get product min price
|
|
114
|
+
*/
|
|
115
|
+
minPrice (): number {
|
|
116
|
+
return this.payload?.minPrice || 0
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get product total sold number
|
|
121
|
+
*/
|
|
122
|
+
totalSoldNum (): number {
|
|
123
|
+
return this.payload?.totalSoldNum || 0
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get product SKUs
|
|
128
|
+
*/
|
|
129
|
+
skus (): PUPPET.payloads.WxxdProductSku[] {
|
|
130
|
+
return this.payload?.skus || []
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
class WxxdProductImplBase extends validationMixin(WxxdProductMixin)<WxxdProductImplInterface>() { }
|
|
136
|
+
interface WxxdProductImplInterface extends WxxdProductImplBase { }
|
|
137
|
+
|
|
138
|
+
type WxxdProductProtectedProperty = 'ready'
|
|
139
|
+
type WxxdProductInterface = Omit<WxxdProductImplInterface, WxxdProductProtectedProperty>
|
|
140
|
+
class WxxdProductImpl extends validationMixin(WxxdProductImplBase)<WxxdProductInterface>() { }
|
|
141
|
+
|
|
142
|
+
type WxxdProductConstructor = Constructor<
|
|
143
|
+
WxxdProductImplInterface,
|
|
144
|
+
typeof WxxdProductImpl
|
|
145
|
+
>
|
|
146
|
+
|
|
147
|
+
export type {
|
|
148
|
+
WxxdProductConstructor,
|
|
149
|
+
WxxdProductProtectedProperty,
|
|
150
|
+
WxxdProductInterface,
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
WxxdProductImpl,
|
|
154
|
+
}
|
|
@@ -30,6 +30,8 @@ import type {
|
|
|
30
30
|
WecomConstructor,
|
|
31
31
|
DouyinOneClickPhoneCollectionConstructor,
|
|
32
32
|
ImSpecificConstructor,
|
|
33
|
+
WxxdProductConstructor,
|
|
34
|
+
WxxdOrderConstructor,
|
|
33
35
|
} from '../user-modules/mod.js'
|
|
34
36
|
|
|
35
37
|
import {
|
|
@@ -67,6 +69,8 @@ test('Wechaty interface', async t => {
|
|
|
67
69
|
Wecom : WecomConstructor
|
|
68
70
|
DouyinOneClickPhoneCollection : DouyinOneClickPhoneCollectionConstructor
|
|
69
71
|
ImSpecific : ImSpecificConstructor
|
|
72
|
+
WxxdProduct : WxxdProductConstructor
|
|
73
|
+
WxxdOrder : WxxdOrderConstructor
|
|
70
74
|
|
|
71
75
|
constructor () {
|
|
72
76
|
super()
|
|
@@ -95,6 +99,8 @@ test('Wechaty interface', async t => {
|
|
|
95
99
|
= this.Wecom
|
|
96
100
|
= this.DouyinOneClickPhoneCollection
|
|
97
101
|
= this.ImSpecific
|
|
102
|
+
= this.WxxdProduct
|
|
103
|
+
= this.WxxdOrder
|
|
98
104
|
= {} as any
|
|
99
105
|
}
|
|
100
106
|
|
|
@@ -758,6 +758,27 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
|
|
|
758
758
|
})
|
|
759
759
|
break
|
|
760
760
|
|
|
761
|
+
case 'wxxd-shop':
|
|
762
|
+
puppet.on('wxxd-shop', async () => {
|
|
763
|
+
const payload = await this.ImSpecific.getWxxdShop()
|
|
764
|
+
this.emit('wxxd-shop', payload)
|
|
765
|
+
})
|
|
766
|
+
break
|
|
767
|
+
|
|
768
|
+
case 'wxxd-product':
|
|
769
|
+
puppet.on('wxxd-product', async ({ productId: id }) => {
|
|
770
|
+
const payload = await this.WxxdProduct.find({ id })
|
|
771
|
+
this.emit('wxxd-product', payload)
|
|
772
|
+
})
|
|
773
|
+
break
|
|
774
|
+
|
|
775
|
+
case 'wxxd-order':
|
|
776
|
+
puppet.on('wxxd-order', async ({ orderId: id }) => {
|
|
777
|
+
const payload = await this.WxxdOrder.find({ id })
|
|
778
|
+
this.emit('wxxd-order', payload)
|
|
779
|
+
})
|
|
780
|
+
break
|
|
781
|
+
|
|
761
782
|
default:
|
|
762
783
|
/**
|
|
763
784
|
* Check: The eventName here should have the type `never`
|
|
@@ -25,6 +25,8 @@ import {
|
|
|
25
25
|
WecomImpl,
|
|
26
26
|
DouyinOneClickPhoneCollectionImpl,
|
|
27
27
|
ImSpecificImpl,
|
|
28
|
+
WxxdProductImpl,
|
|
29
|
+
WxxdOrderImpl,
|
|
28
30
|
|
|
29
31
|
ContactConstructor,
|
|
30
32
|
ContactSelfConstructor,
|
|
@@ -50,6 +52,8 @@ import {
|
|
|
50
52
|
WecomConstructor,
|
|
51
53
|
DouyinOneClickPhoneCollectionConstructor,
|
|
52
54
|
ImSpecificConstructor,
|
|
55
|
+
WxxdProductConstructor,
|
|
56
|
+
WxxdOrderConstructor,
|
|
53
57
|
wechatifyUserModule,
|
|
54
58
|
} from '../user-modules/mod.js'
|
|
55
59
|
|
|
@@ -91,6 +95,8 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
91
95
|
__wechatifiedWecom? : WecomConstructor
|
|
92
96
|
__wechatifiedDouyinOneClickPhoneCollection? : DouyinOneClickPhoneCollectionConstructor
|
|
93
97
|
__wechatifiedImSpecific? : ImSpecificConstructor
|
|
98
|
+
__wechatifiedWxxdProduct? : WxxdProductConstructor
|
|
99
|
+
__wechatifiedWxxdOrder? : WxxdOrderConstructor
|
|
94
100
|
|
|
95
101
|
get Contact () : ContactConstructor { return guardWechatify(this.__wechatifiedContact) }
|
|
96
102
|
get ContactSelf () : ContactSelfConstructor { return guardWechatify(this.__wechatifiedContactSelf) }
|
|
@@ -116,6 +122,8 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
116
122
|
get Wecom () : WecomConstructor { return guardWechatify(this.__wechatifiedWecom) }
|
|
117
123
|
get DouyinOneClickPhoneCollection () : DouyinOneClickPhoneCollectionConstructor { return guardWechatify(this.__wechatifiedDouyinOneClickPhoneCollection) }
|
|
118
124
|
get ImSpecific () : ImSpecificConstructor { return guardWechatify(this.__wechatifiedImSpecific) }
|
|
125
|
+
get WxxdProduct () : WxxdProductConstructor { return guardWechatify(this.__wechatifiedWxxdProduct) }
|
|
126
|
+
get WxxdOrder () : WxxdOrderConstructor { return guardWechatify(this.__wechatifiedWxxdOrder) }
|
|
119
127
|
|
|
120
128
|
override async init (): Promise<void> {
|
|
121
129
|
log.verbose('WechatifyUserModuleMixin', 'init()')
|
|
@@ -161,6 +169,8 @@ const wechatifyUserModuleMixin = <MixinBase extends typeof WechatySkeleton> (mix
|
|
|
161
169
|
this.__wechatifiedWecom = wechatifyUserModule(WecomImpl)(this as any)
|
|
162
170
|
this.__wechatifiedDouyinOneClickPhoneCollection = wechatifyUserModule(DouyinOneClickPhoneCollectionImpl)(this as any)
|
|
163
171
|
this.__wechatifiedImSpecific = wechatifyUserModule(ImSpecificImpl)(this as any)
|
|
172
|
+
this.__wechatifiedWxxdProduct = wechatifyUserModule(WxxdProductImpl)(this as any)
|
|
173
|
+
this.__wechatifiedWxxdOrder = wechatifyUserModule(WxxdOrderImpl)(this as any)
|
|
164
174
|
|
|
165
175
|
log.verbose('WechatifyUserModuleMixin', 'init() initializing Wechaty User Module (WUM) ... done')
|
|
166
176
|
}
|
|
@@ -206,6 +216,8 @@ type ProtectedPropertyWechatifyUserModuleMixin =
|
|
|
206
216
|
| '__wechatifiedWecom'
|
|
207
217
|
| '__wechatifiedDouyinOneClickPhoneCollection'
|
|
208
218
|
| '__wechatifiedImSpecific'
|
|
219
|
+
| '__wechatifiedWxxdProduct'
|
|
220
|
+
| '__wechatifiedWxxdOrder'
|
|
209
221
|
|
|
210
222
|
export type {
|
|
211
223
|
WechatifyUserModuleMixin,
|